Skip to content

Commit

Permalink
♻️ improve components
Browse files Browse the repository at this point in the history
  • Loading branch information
Yago committed Dec 17, 2020
1 parent 1518f42 commit e74a567
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 188 deletions.
11 changes: 3 additions & 8 deletions src/components/organisms/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ export default {
component: Header,
};

const Template = (args) => <Header {...args} />;
const Template = () => <Header />;

export const LoggedIn = Template.bind({});
LoggedIn.args = {
user: {},
};

export const LoggedOut = Template.bind({});
LoggedOut.args = {};
export const Default = Template.bind({});
Default.args = {};
29 changes: 3 additions & 26 deletions src/components/organisms/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,9 @@ import React from 'react';
import Button from 'components/atoms/Button';

const Header = (): JSX.Element => (
<header>
<div className="wrapper">
<div>
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fillRule="evenodd">
<path
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
fill="#FFF"
/>
<path
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
fill="#555AB9"
/>
<path
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
fill="#91BAF8"
/>
</g>
</svg>
<h1>Acme</h1>
</div>
<div>
<Button size="small" label="Log in" />
<Button primary size="small" label="Sign up" />
</div>
</div>
<header className="flex items-center justify-between p-4 bg-gray-50">
<h1>Header</h1>
<Button size="small" label="Log in" />
</header>
);

Expand Down
3 changes: 3 additions & 0 deletions src/components/pages/Homepage/Homepage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.homepage {
@apply text-gray-900;
}
12 changes: 12 additions & 0 deletions src/components/pages/Homepage/Homepage.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

import Homepage from './Homepage';

export default {
title: 'Pages/Homepage',
component: Homepage,
};

const Template = () => <Homepage />;

export const Default = Template.bind({});
26 changes: 26 additions & 0 deletions src/components/pages/Homepage/Homepage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';

import Header from 'components/organisms/Header';

const Page = (): JSX.Element => (
<main className="container mx-auto homepage">
<Header />

<article className="mx-auto md:w-1/2">
<h1 className="my-8 text-3xl font-bold">Pages in Storybook</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vitae autem
degendae ratio maxime quidem illis placuit quieta. Et hunc idem dico,
inquieta sed ad virtutes et ad vitia nihil interesse. Si quidem, inquit,
tollerem, sed relinquo. Ut alios omittam, hunc appello, quem ille unum
secutus est. -, sed ut hoc iudicaremus, non esse in iis partem maximam
positam beate aut secus vivendi. Itaque a sapientia praecipitur se
ipsam, si usus sit, sapiens ut relinquat. Restinguet citius, si ardentem
acceperit. Duo Reges: constructio interrete. Quae quidem sapientes
sequuntur duce natura tamquam videntes;
</p>
</article>
</main>
);

export default Page;
69 changes: 0 additions & 69 deletions src/components/pages/Homepage/Page.css

This file was deleted.

21 changes: 0 additions & 21 deletions src/components/pages/Homepage/Page.stories.tsx

This file was deleted.

62 changes: 0 additions & 62 deletions src/components/pages/Homepage/Page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/pages/Homepage/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './Page';
export { default } from './Homepage';
2 changes: 1 addition & 1 deletion src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
/* ORGANISMS */

/* PAGES */
@import "../components/pages/Homepage/Page.css";
@import "../components/pages/Homepage/Homepage.css";

0 comments on commit e74a567

Please sign in to comment.