Skip to content

Commit

Permalink
feat: Layout (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
RabbitDoge authored Oct 21, 2020
1 parent 576c2a1 commit 72162ed
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/components/Layouts/BaseLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import styled from "styled-components";

const GridLayout = styled.div`
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 16px;
${({ theme }) => theme.scales.mediaQueries.sm} {
grid-template-columns: repeat(8, 1fr);
grid-gap: 24px;
}
${({ theme }) => theme.scales.mediaQueries.md} {
grid-template-columns: repeat(12, 1fr);
grid-gap: 24px;
}
${({ theme }) => theme.scales.mediaQueries.lg} {
grid-template-columns: repeat(12, 1fr);
grid-gap: 32px;
}
`;

export default GridLayout;
13 changes: 13 additions & 0 deletions src/components/Layouts/CardsLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from "styled-components";
import BaseLayout from "./BaseLayout";

const GridLayout = styled(BaseLayout)`
& > div {
grid-column: span 6;
${({ theme }) => theme.scales.mediaQueries.sm} {
grid-column: span 4;
}
}
`;

export default GridLayout;
34 changes: 34 additions & 0 deletions src/components/Layouts/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import styled from "styled-components";
import { BaseLayout, CardsLayout } from ".";

export default {
title: "Layouts",
argTypes: {},
};

const Stub = styled.div`
width: 100%;
background: #1fc7d4;
height: 300px;
`;

export const Base: React.FC = () => {
return (
<BaseLayout>
{[...Array(24)].map((value) => (
<Stub key={value} />
))}
</BaseLayout>
);
};

export const Cards: React.FC = () => {
return (
<CardsLayout>
{[...Array(10)].map((value) => (
<Stub key={value} />
))}
</CardsLayout>
);
};
2 changes: 2 additions & 0 deletions src/components/Layouts/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as BaseLayout } from "./BaseLayout";
export { default as CardsLayout } from "./CardsLayout";
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// eslint-disable-next-line import/prefer-default-export
export { default as Button } from "./components/Button";
export { default as ButtonMenu } from "./components/ButtonMenu";
export { default as ButtonMenuItem } from "./components/ButtonMenu/ButtonMenuItem";
export { default as Card } from "./components/Card";
export { default as Checkbox } from "./components/Checkbox";
export { default as Heading } from "./components/Heading";
export * from "./components/Layouts";
export { default as Text } from "./components/Text";
export { default as Link } from "./components/Link";
export { default as ResetCSS } from "./ResetCSS";
Expand Down

0 comments on commit 72162ed

Please sign in to comment.