Skip to content

Commit 829c837

Browse files
committed
grid component
1 parent 7c62ed4 commit 829c837

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

src/lib/consts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const MAX_PAGE_WIDTH: number = 1700;

src/lib/features/Grid.stories.svelte

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script>
2+
import Grid from './Grid.svelte';
3+
import { Meta, Story } from '@storybook/addon-svelte-csf';
4+
5+
const content = [
6+
'Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s,',
7+
'when an unknown printer took a galley of type and scrambled it to make a type specimen book.',
8+
'It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.',
9+
'It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,',
10+
'and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.',
11+
'Contrary to popular belief, Lorem Ipsum is not simply random text.',
12+
'It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.',
13+
'Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words:',
14+
'consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source.',
15+
'Quisque vitae ipsum enim.',
16+
'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. ',
17+
'Aliquam lobortis nisl mi, et ultrices mi gravida ac.',
18+
];
19+
</script>
20+
<Meta title="Design System/Grid" />
21+
Resize window or activate responsive sizing in the development panel to see grid changes.
22+
<Story name="Grid">
23+
<Grid class="xs:text-xs md:text-sm">
24+
{#each content as line, i}
25+
<p><b>Paragraph {i+1}: </b>
26+
{line}
27+
</p>
28+
{/each}
29+
</Grid>
30+
<p>Source: <a class="underline text-brightBlue hover:text-gray2" href="https://www.lipsum.com/">Lorem Ipsum</a></p>
31+
</Story>

src/lib/features/Grid.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<style>
2+
</style>
3+
<div class="m-4 md:m-8 lg:m-32 {$$restProps.class}">
4+
<div class="grid grid-cols-4 gap-4 sm:grid-cols-4 md:gap-8 md:grid-cols-6 lg:grid-cols-12 lg:gap-8">
5+
<slot />
6+
</div>
7+
</div>

tailwind.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import tailwindColors from './src/lib/styles/tailwindColors';
2+
import { MAX_PAGE_WIDTH } from './src/lib/consts';
23

34
/** @type {import('tailwindcss').Config} */
45
export default {
@@ -68,6 +69,17 @@ export default {
6869
lg: '0px 4px 10px 0px #00000040',
6970
},
7071
},
72+
screens: {
73+
xs: '0',
74+
sm: '320px',
75+
md: '744px',
76+
lg: '1300px',
77+
xl: `${MAX_PAGE_WIDTH}px`,
78+
'vertical-lg': { raw: '(max-height: 700px) and (min-width: 1300px)' },
79+
'vertical-md': { raw: '(max-height: 700px) and (min-width: 900px)' },
80+
vertical: { raw: '(max-height: 700px) or (min-width: 0px)' },
81+
horizontal: { raw: '(min-height: 700px) and (min-width: 1300px)' },
82+
},
7183
},
7284
plugins: [],
7385
};

0 commit comments

Comments
 (0)