themed infobox
This commit is contained in:
parent
3ed750ce96
commit
6a7a34ef0a
4 changed files with 29 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
es2022: true,
|
es2022: true,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
indent: ['error', 2, { 'SwitchCase': 1 }],
|
indent: ['error', 2, { SwitchCase: 1 }],
|
||||||
semi: ['error', 'always'],
|
semi: ['error', 'always'],
|
||||||
'comma-dangle': [
|
'comma-dangle': [
|
||||||
'error',
|
'error',
|
||||||
|
|
@ -36,7 +36,7 @@ module.exports = {
|
||||||
files: ['*.svelte'],
|
files: ['*.svelte'],
|
||||||
parser: 'svelte-eslint-parser',
|
parser: 'svelte-eslint-parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: '@typescript-eslint/parser'
|
parser: '@typescript-eslint/parser',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 2 }],
|
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 2 }],
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@
|
||||||
const metaProps = {
|
const metaProps = {
|
||||||
...withComponentDocs(componentDocs),
|
...withComponentDocs(componentDocs),
|
||||||
argTypes: {
|
argTypes: {
|
||||||
|
theme: {
|
||||||
|
control: 'select',
|
||||||
|
options: ['light', 'dark'],
|
||||||
|
},
|
||||||
width: {
|
width: {
|
||||||
control: 'select',
|
control: 'select',
|
||||||
options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
|
options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
<!-- @component `EndNotes` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-InfoBox--default) -->
|
<!-- @component `EndNotes` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-InfoBox--default) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ContainerWidth } from '../@types/global';
|
import type { ContainerWidth } from '../@types/global';
|
||||||
|
/* eslint svelte/no-at-html-tags: "off" */
|
||||||
|
|
||||||
|
type Theme = 'light' | 'dark';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title of the box
|
* Title of the box
|
||||||
*/
|
*/
|
||||||
|
|
@ -34,11 +38,16 @@
|
||||||
*/
|
*/
|
||||||
export let id: string = '';
|
export let id: string = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page theme
|
||||||
|
*/
|
||||||
|
export let theme: Theme = 'light';
|
||||||
|
|
||||||
import Block from '../Block/Block.svelte';
|
import Block from '../Block/Block.svelte';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<aside class="infobox">
|
<aside class="infobox {theme}">
|
||||||
<Block
|
<Block
|
||||||
width="{width}"
|
width="{width}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
|
|
@ -79,7 +88,17 @@
|
||||||
.infobox {
|
.infobox {
|
||||||
:global(.article-block) {
|
:global(.article-block) {
|
||||||
border-color: var(--theme-colour-brand-rules);
|
border-color: var(--theme-colour-brand-rules);
|
||||||
background-color: #fafafa;
|
}
|
||||||
|
|
||||||
|
&.light {
|
||||||
|
:global(.article-block) {
|
||||||
|
background-color: rgb(250 250 250 / 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.dark {
|
||||||
|
:global(.article-block) {
|
||||||
|
background-color: rgb(250 250 250 / 10%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.header p) {
|
:global(.header p) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
InfoBox is used to provide additional information that needs to be visually set aside from the main content flow. e.g. Methodology, Detailed notes about data, Extra context as text stories.
|
InfoBox is used to provide additional information that needs to be visually set aside from the main content flow. e.g. Methodology, Detailed notes about data, Extra context as text stories.
|
||||||
|
|
||||||
|
Switch the theme prop to `dark` for a dark page infobox.
|
||||||
|
|
||||||
Use the slots to customize the content as needed, e.g. adding icons and thumbnail images etc.
|
Use the slots to customize the content as needed, e.g. adding icons and thumbnail images etc.
|
||||||
|
|
||||||
```svelte
|
```svelte
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue