Skip to content

Commit

Permalink
feat: Add reset.css component (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
RabbitDoge authored Oct 19, 2020
1 parent e5ab247 commit 855e648
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 18 deletions.
12 changes: 11 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: ["@storybook/addon-links", "@storybook/addon-essentials", "themeprovider-storybook/register"],
addons: [
{
name: "@storybook/addon-essentials",
options: {
backgrounds: false,
},
},
"@storybook/addon-links",
"@storybook/addon-a11y",
"themeprovider-storybook/register",
],
};
17 changes: 2 additions & 15 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
import React from "react";
import { withThemesProvider } from "themeprovider-storybook";
import { createGlobalStyle } from "styled-components";
import light from "../src/theme/light";
import dark from "../src/theme/dark";

const Global = createGlobalStyle`
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: 'Kanit', sans-serif;
}
`;
import ResetCSS from "../src/ResetCSS";

const globalDecorator = (StoryFn) => (
<>
<Global />
<ResetCSS />
<StoryFn />
</>
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"@storybook/addon-a11y": "^6.0.26",
"@storybook/addon-actions": "^6.0.26",
"@storybook/addon-essentials": "^6.0.26",
"@storybook/addon-links": "^6.0.26",
Expand Down
72 changes: 72 additions & 0 deletions src/ResetCSS.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { createGlobalStyle } from "styled-components";

const ResetCSS = createGlobalStyle`
/* prettier-ignore */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
/* prettier-ignore */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: disc;
list-style-position: inside;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
a {
color: inherit;
text-decoration: none;
}
[role="button"] {
cursor: pointer;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
font-family: 'Noto Sans', "Helvetica Neue", Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
`;

export default ResetCSS;
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// eslint-disable-next-line import/prefer-default-export
export { default as Button } from "./components/Button";
export { default as ResetCSS } from "./ResetCSS";

export * from "./theme";
26 changes: 24 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,28 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@storybook/addon-a11y@^6.0.26":
version "6.0.26"
resolved "https://registry.yarnpkg.com/@storybook/addon-a11y/-/addon-a11y-6.0.26.tgz#b71761d9b8f8b340894eb9826d51ce319ce65116"
integrity sha512-sx1Ethl9W3Kfns0qB1v0CoAymKTC+odB+rCjUKM1h/ILS/n8ZzwkzAj0L7DU/6wA0nZwZDQ+1wL2ZN7r+vxr8A==
dependencies:
"@storybook/addons" "6.0.26"
"@storybook/api" "6.0.26"
"@storybook/channels" "6.0.26"
"@storybook/client-api" "6.0.26"
"@storybook/client-logger" "6.0.26"
"@storybook/components" "6.0.26"
"@storybook/core-events" "6.0.26"
"@storybook/theming" "6.0.26"
axe-core "^3.5.2"
core-js "^3.0.1"
global "^4.3.2"
lodash "^4.17.15"
react-sizeme "^2.5.2"
regenerator-runtime "^0.13.3"
ts-dedent "^1.1.1"
util-deprecate "^1.0.2"

"@storybook/addon-actions@6.0.26", "@storybook/addon-actions@^6.0.26":
version "6.0.26"
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-6.0.26.tgz#d0de9e4d78a8f8f5bf8730c04d0b6d1741c29273"
Expand Down Expand Up @@ -3308,7 +3330,7 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.1.tgz#e1e82e4f3e999e2cfd61b161280d16a111f86428"
integrity sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==

axe-core@^3.5.4:
axe-core@^3.5.2, axe-core@^3.5.4:
version "3.5.5"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.5.tgz#84315073b53fa3c0c51676c588d59da09a192227"
integrity sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q==
Expand Down Expand Up @@ -10166,7 +10188,7 @@ react-popper@^1.3.7:
typed-styles "^0.0.7"
warning "^4.0.2"

react-sizeme@^2.6.7:
react-sizeme@^2.5.2, react-sizeme@^2.6.7:
version "2.6.12"
resolved "https://registry.yarnpkg.com/react-sizeme/-/react-sizeme-2.6.12.tgz#ed207be5476f4a85bf364e92042520499455453e"
integrity sha512-tL4sCgfmvapYRZ1FO2VmBmjPVzzqgHA7kI8lSJ6JS6L78jXFNRdOZFpXyK6P1NBZvKPPCZxReNgzZNUajAerZw==
Expand Down

0 comments on commit 855e648

Please sign in to comment.