From cfeb4a6de27e7eeb12ce42388c999483100d82d2 Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Mon, 17 Mar 2025 11:31:51 -0700 Subject: [PATCH] set up block docs --- .../{stories/docs/snapWidths.md => Block.mdx} | 48 ++++++++++- src/components/Block/Block.stories.svelte | 84 ++++++++----------- .../Block/stories/docs/component.md | 15 ---- .../Block/stories/docs/customLayouts.md | 13 --- 4 files changed, 80 insertions(+), 80 deletions(-) rename src/components/Block/{stories/docs/snapWidths.md => Block.mdx} (54%) delete mode 100644 src/components/Block/stories/docs/component.md delete mode 100644 src/components/Block/stories/docs/customLayouts.md diff --git a/src/components/Block/stories/docs/snapWidths.md b/src/components/Block/Block.mdx similarity index 54% rename from src/components/Block/stories/docs/snapWidths.md rename to src/components/Block/Block.mdx index cd9135f5..93f7619c 100644 --- a/src/components/Block/stories/docs/snapWidths.md +++ b/src/components/Block/Block.mdx @@ -1,9 +1,51 @@ +import { Meta, Canvas } from '@storybook/blocks'; + +import * as BlockStories from './Block.stories.svelte'; + + + +# Block + +The `Block` component is the basic building block of stories, a responsive container that wraps each section of your piece. + +Blocks are stacked vertically within the well created by the [`Article`](./?path=/docs/layout-article) component. They can have different widths on larger screens depending on the `width` prop. + +> 📌 Many of our other components already use the `Block` component, internally. You'll usually only need to use it yourself if you're making something custom. + +```svelte + + + + + +``` + +## Custom layouts + +Our article well is designed to provide a basic responsive layout for you, but it's also made to get out of the way quickly when you need to do something custom. + +If you need to get really radical, the easiest way is to create a `Block` with a `fluid` width -- which basically cancels out the article well dimensions -- and then code whatever you need from scratch or with another framework. + +```svelte + +
+ +
+
+``` + +The demo below does exactly that to create an edge-to-edge grid with [flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). + +## Snap widths + Normally, `Block` containers resize fluidly below the original `width`. Sometimes, though, you may want the container to snap to the next breakpoint -- for example, if you have a static graphic that looks fine at the set block breakpoints, but isn't so great at widths inbetween. You can use the `snap` prop to force the container to snap to each block width successively as the window sizes down. ```svelte - + ``` @@ -12,7 +54,7 @@ If you want to skip certain block widths entirely, you can add one or more class ```svelte - + ``` @@ -28,7 +70,7 @@ Snap width breakpoints are hard-coded to the default article well column widths, Luckily, it's still pretty easy. Just add a `cls` or `id` to your `Block` so you can target it with some custom SCSS. Now, defined a few SCSS variables corresponding to your custom column widths and use the `block-snap-widths` SCSS mixin to get the same functionality at your custom breakpoints. ```svelte - + diff --git a/src/components/Block/Block.stories.svelte b/src/components/Block/Block.stories.svelte index a13a0411..a73274dc 100644 --- a/src/components/Block/Block.stories.svelte +++ b/src/components/Block/Block.stories.svelte @@ -1,19 +1,11 @@ + - + - + - +
@@ -73,51 +59,51 @@ - +