From 470c73939af5e5c37b6ac8ccb928bc3d8bdd99a2 Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Tue, 18 Mar 2025 11:50:37 -0700 Subject: [PATCH] updates photo --- src/components/FeaturePhoto/FeaturePhoto.mdx | 72 +++++++++ .../FeaturePhoto/FeaturePhoto.stories.svelte | 47 +----- .../FeaturePhoto/FeaturePhoto.svelte | 144 ++++++++++-------- .../{stories => images}/shark.jpg | Bin .../FeaturePhoto/stories/docs/archieML.md | 37 ----- .../FeaturePhoto/stories/docs/component.md | 16 -- .../stories/docs/missingAltText.md | 1 - 7 files changed, 159 insertions(+), 158 deletions(-) create mode 100644 src/components/FeaturePhoto/FeaturePhoto.mdx rename src/components/FeaturePhoto/{stories => images}/shark.jpg (100%) delete mode 100644 src/components/FeaturePhoto/stories/docs/archieML.md delete mode 100644 src/components/FeaturePhoto/stories/docs/component.md delete mode 100644 src/components/FeaturePhoto/stories/docs/missingAltText.md diff --git a/src/components/FeaturePhoto/FeaturePhoto.mdx b/src/components/FeaturePhoto/FeaturePhoto.mdx new file mode 100644 index 00000000..9ea5a3af --- /dev/null +++ b/src/components/FeaturePhoto/FeaturePhoto.mdx @@ -0,0 +1,72 @@ +import { Meta, Canvas } from '@storybook/blocks'; + +import * as FeaturePhotoStories from './FeaturePhoto.stories.svelte'; + + + +# FeaturePhoto + +The `FeaturePhoto` component adds a full-width photo. + +```svelte + + + +``` + + + +## Using with ArchieML docs + +With the Graphics Kit, you'll likely get your text value from an ArchieML doc... + +```yaml +# ArchieML doc +[blocks] + +type: photo +width: normal +src: images/shark.jpg +altText: The king of the sea +caption: Carcharodon carcharias - REUTERS + +[] +``` + +... which you'll parse out of a ArchieML block object before passing to the `FeaturePhoto` component. + +```svelte + + + +{#each content.blocks as block} + {#if block.Type === 'text'} + + {:else if block.type === 'photo'} + + {/if} +{/each} +``` + +## Missing alt text + +`altText` is required in this component. If your photo is missing it, a small red text box will overlay the image. + + diff --git a/src/components/FeaturePhoto/FeaturePhoto.stories.svelte b/src/components/FeaturePhoto/FeaturePhoto.stories.svelte index 07b53afb..55769963 100644 --- a/src/components/FeaturePhoto/FeaturePhoto.stories.svelte +++ b/src/components/FeaturePhoto/FeaturePhoto.stories.svelte @@ -1,26 +1,10 @@ - - - - - diff --git a/src/components/FeaturePhoto/FeaturePhoto.svelte b/src/components/FeaturePhoto/FeaturePhoto.svelte index 0ff0b7f6..a750d23d 100644 --- a/src/components/FeaturePhoto/FeaturePhoto.svelte +++ b/src/components/FeaturePhoto/FeaturePhoto.svelte @@ -1,75 +1,89 @@ - - -{#each content.blocks as block} - {#if block.Type === 'text'} - - - {:else if block.type === 'photo'} - - - - {/if} -{/each} -``` diff --git a/src/components/FeaturePhoto/stories/docs/component.md b/src/components/FeaturePhoto/stories/docs/component.md deleted file mode 100644 index 846cfcf9..00000000 --- a/src/components/FeaturePhoto/stories/docs/component.md +++ /dev/null @@ -1,16 +0,0 @@ -A full-width photo inside the text well. - -```svelte - - - -``` diff --git a/src/components/FeaturePhoto/stories/docs/missingAltText.md b/src/components/FeaturePhoto/stories/docs/missingAltText.md deleted file mode 100644 index 48016d3e..00000000 --- a/src/components/FeaturePhoto/stories/docs/missingAltText.md +++ /dev/null @@ -1 +0,0 @@ -If your photo is missing `altText` a small warning will overlay the image.