Skip to content

Commit

Permalink
docs: breakout page (#3154)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahgm authored Jul 19, 2023
1 parent dcc4315 commit 36e30a6
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import { Box, Breakout, Container } from '@marigold/components';
import { Breakout, Container } from '@marigold/components';

export const HorizontalBreakout = () => (
<Container align="center">
<Box
css={{
border: '1px solid #ced4da',
bg: '#e9ecef',
height: '80px',
width: '100%',
}}
/>
<div className="h-20 w-full border border-slate-300 bg-slate-200" />
<Breakout alignX="right">
<Box>BREAKOUT with right aligned content</Box>
<div>BREAKOUT with right aligned content</div>
</Breakout>
<Box
css={{
border: '1px solid #ced4da',
bg: '#e9ecef',
height: '80px',
width: '100%',
}}
/>
<div className="h-20 w-full border border-slate-300 bg-slate-200" />
</Container>
);
68 changes: 68 additions & 0 deletions docs/content/components/breakout/breakout.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Breakout
group: Layout
caption: Component that breaks out of a grid layout context.
---

`<Breakout>` is a layout component which lets you span the full row in a CSS grid context e.g. our [`<Container>`](container/) component.

You need this component if you want to display something out of the context. It is also possible to put several components into the `<Breakout>`.

You can use `alignX` or `alignY` to place the items inside the `<Breakout>` element.

## Usage

### Import

To import the component you just have to use this code below.

```tsx
import { Breakout } from '@marigold/components';
```

### Props

<PropsTable
props={[
{
property: 'alignX',
type: '"left" | "right" | "center"',
description:
'Horizontal alignment of the items inside the breakout element.',
default: 'left',
},
{
property: 'alignY',
type: '"top" | "bottom" | "center"',
description:
'Vertical alignment of the items inside the breakout element.',
default: 'top',
},
{
property: 'height',
type: 'string',
description: 'Set the height of the breakout element.',
default: 'none',
},
]}
/>

## Examples

### Vertical alignment

In this case the `height` prop is necessary, if you haven't set it, the `alignY` has no impact.

<ComponentDemo file="./vertical-breakout.demo.tsx" />

### Horizontal alignment

Example to show how the `alignX` prop is to set. Options are `"left" | "center" | "right"`. The default value is `left`.

<ComponentDemo file="./horizontal-breakout.demo.tsx" />

### Breakout iframe

This example shows how to use an `<iframe>` within a `<Breakout>`.

<ComponentDemo file="./iframe-breakout.demo.tsx" />
11 changes: 11 additions & 0 deletions docs/content/components/breakout/horizontal-breakout.demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Breakout, Container } from '@marigold/components';

export default () => (
<Container align="center">
<div className="h-20 w-full border border-slate-300 bg-slate-200" />
<Breakout alignX="right">
<div>BREAKOUT with right aligned content</div>
</Breakout>
<div className="h-20 w-full border border-slate-300 bg-slate-200" />
</Container>
);
29 changes: 29 additions & 0 deletions docs/content/components/breakout/iframe-breakout.demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Aspect, Breakout, Container } from '@marigold/components';

export default () => (
<Container align="center">
<p className="p-1">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</p>
<Breakout alignX="center" alignY="center">
<Aspect ratio="ultrawide">
<iframe
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d4820.000043444012!2d7.826018541821473!3d48.020383262446884!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47911b1e29425703%3A0xbe342117a976e59!2sEuropa-Park%20Stadion!5e1!3m2!1sde!2sde!4v1647595604899!5m2!1sde!2sde"
title="sc_map"
width="100%"
height="100%"
/>
</Aspect>
</Breakout>
<p className="p-2">
It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the
1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.
</p>
</Container>
);
13 changes: 13 additions & 0 deletions docs/content/components/breakout/vertical-breakout.demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Breakout, Container } from '@marigold/components';

export default () => (
<Container align="center">
<div className="h-20 w-full border border-slate-300 bg-slate-200" />
<Breakout height="100px" alignY="bottom">
<div className="border border-slate-300 bg-slate-200">
BREAKOUT with bottom alignment
</div>
</Breakout>
<div className="h-20 w-full border border-slate-300 bg-slate-200" />
</Container>
);
21 changes: 21 additions & 0 deletions docs/registry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,25 @@ export const registry = {
),
file: 'content/components/button/button-variant.demo.tsx',
},
'horizontal-breakout': {
name: 'horizontal-breakout',
demo: dynamic(
() => import('@/content/components/breakout/horizontal-breakout.demo')
),
file: 'content/components/breakout/horizontal-breakout.demo.tsx',
},
'iframe-breakout': {
name: 'iframe-breakout',
demo: dynamic(
() => import('@/content/components/breakout/iframe-breakout.demo')
),
file: 'content/components/breakout/iframe-breakout.demo.tsx',
},
'vertical-breakout': {
name: 'vertical-breakout',
demo: dynamic(
() => import('@/content/components/breakout/vertical-breakout.demo')
),
file: 'content/components/breakout/vertical-breakout.demo.tsx',
},
} as const;

2 comments on commit 36e30a6

@vercel
Copy link

@vercel vercel bot commented on 36e30a6 Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marigold-docs – ./

marigold-docs-marigold.vercel.app
marigold-docs-git-main-marigold.vercel.app
marigold-docs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 36e30a6 Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marigold-storybook – ./

marigold-storybook-marigold.vercel.app
marigold-latest.vercel.app
marigold-storybook-git-main-marigold.vercel.app

Please sign in to comment.