Skip to content

Commit

Permalink
feat: export stitches functions as part of library
Browse files Browse the repository at this point in the history
  • Loading branch information
pyadav authored and ravisuhag committed Apr 4, 2023
1 parent 4b8ac15 commit a048cd9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 35 deletions.
40 changes: 40 additions & 0 deletions components/global.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { dark, globalCss } from "~/stitches.config";

export const globalStyles = globalCss({
"*, *:before, *:after": {
margin: 0,
boxSizing: "border-box",
},
"*": {
margin: 0,
},
html: {
fontSize: "10px",
},
"html, body": {
fontFamily: "$inter",
},
body: {
fontSize: "1.2rem",
color: "$hiContrast",
backgroundColor: "$olive1",
overflowX: "hidden",
textRendering: "optimizelegibility",
"-webkit-font-smoothing": "antialiased",
},
a: {
color: "$anchor",
},

[`${dark}`]: {},
});

export const ApsaraGlobalStyle = () => {
globalStyles();
globalCss({
"@font-face": [],
"@import": ["url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap')"],
})();

return null;
};
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export { config, createTheme, css, getCssText, globalCss, keyframes, reset, styled, theme } from "~/stitches.config";
// components
export { Box } from "./components/box";
export { ApsaraGlobalStyle } from "./components/global";
35 changes: 0 additions & 35 deletions stitches.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,41 +470,6 @@ export const dark = createTheme("dark", {
},
});

export const globalStyles = globalCss({
"*, *:before, *:after": {
margin: 0,
boxSizing: "border-box",
},
"*": {
margin: 0,
},
html: {
fontSize: "10px",
},
"html, body": {
fontFamily: "$inter",
},
body: {
fontSize: "1.2rem",
color: "$hiContrast",
backgroundColor: "$olive1",
overflowX: "hidden",
textRendering: "optimizelegibility",
"-webkit-font-smoothing": "antialiased",
},
a: {
color: "$anchor",
},

[`${dark}`]: {},
});

globalStyles();
globalCss({
"@font-face": [],
"@import": ["url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap')"],
})();

type CSS = Stitches.CSS<typeof config>;
type StitchesConfig = typeof config;
type ScaleValue<TValue> = Stitches.ScaleValue<TValue, StitchesConfig>;
Expand Down

0 comments on commit a048cd9

Please sign in to comment.