From 2067283d7debd7b0277246e571488cfdd1bae98e Mon Sep 17 00:00:00 2001 From: hobbes7878 Date: Fri, 4 Apr 2025 20:35:14 +0100 Subject: [PATCH] fixes styles for chart text furniture. fixes newlines in demo --- src/components/GraphicBlock/GraphicBlock.mdx | 2 +- .../GraphicBlock/GraphicBlock.stories.svelte | 2 +- .../GraphicBlock/GraphicBlock.svelte | 117 +++++++++--------- .../GraphicBlock/components/TextBlock.svelte | 1 + 4 files changed, 63 insertions(+), 59 deletions(-) diff --git a/src/components/GraphicBlock/GraphicBlock.mdx b/src/components/GraphicBlock/GraphicBlock.mdx index 3df1e4e3..10ef9fea 100644 --- a/src/components/GraphicBlock/GraphicBlock.mdx +++ b/src/components/GraphicBlock/GraphicBlock.mdx @@ -18,7 +18,7 @@ Many other Reuters Graphics components use `GraphicBlock` to wrap graphics with
diff --git a/src/components/GraphicBlock/GraphicBlock.stories.svelte b/src/components/GraphicBlock/GraphicBlock.stories.svelte index 07c70115..f19268eb 100644 --- a/src/components/GraphicBlock/GraphicBlock.stories.svelte +++ b/src/components/GraphicBlock/GraphicBlock.stories.svelte @@ -27,7 +27,7 @@
placeholder diff --git a/src/components/GraphicBlock/GraphicBlock.svelte b/src/components/GraphicBlock/GraphicBlock.svelte index 0ae66ca8..e8cef209 100644 --- a/src/components/GraphicBlock/GraphicBlock.svelte +++ b/src/components/GraphicBlock/GraphicBlock.svelte @@ -74,72 +74,75 @@ }: Props = $props(); - - - {#if typeof title === 'string'} - - -

{title}

- {#if description} - +
+ + + {#if typeof title === 'string'} + + +

{title}

+ {#if description} + + {/if} +
+
+ {:else if title} + + + + {@render title()} + + + {/if} + + {#if ariaDescription} +
+ {#if typeof ariaDescription === 'string'} + + {:else} + + {@render ariaDescription()} {/if} - - - {:else if title} - - - - {@render title()} - - - {/if} - - {#if ariaDescription} -
- {#if typeof ariaDescription === 'string'} - - {:else} - - {@render ariaDescription()} - {/if} -
- {/if} - {#if typeof notes === 'string'} - - - - - - {:else if notes} - - - - {@render notes()} - - - {/if} - +
+ {/if} + {#if typeof notes === 'string'} + + + + + + {:else if notes} + + + + {@render notes()} + + + {/if} +
+
- diff --git a/src/components/GraphicBlock/components/TextBlock.svelte b/src/components/GraphicBlock/components/TextBlock.svelte index b354973a..c7413fd5 100644 --- a/src/components/GraphicBlock/components/TextBlock.svelte +++ b/src/components/GraphicBlock/components/TextBlock.svelte @@ -3,6 +3,7 @@ import type { ContainerWidth } from '../../@types/global'; import Block from '../../Block/Block.svelte'; + interface Props { /** Width of the component within the text well. */ width?: ContainerWidth;