@@ -5,11 +5,14 @@ import { withA11y } from '@storybook/addon-a11y';
55import { addDecorator , addParameters , configure } from '@storybook/react' ;
66import { themes } from '@storybook/theming' ;
77import { createGlobalStyle , ThemeProvider } from 'styled-components' ;
8- // @ts -ignore
9- import global from './global.css' ;
108import { makeTheme , getThemes } from '../src/components/ThemeProvider' ;
119import { withThemesProvider } from './storybook-addon-styled-component-theme' ;
1210
11+ type Theme = {
12+ colors : any ;
13+ name : string ;
14+ } ;
15+
1316const viewports = {
1417 mobile : {
1518 name : 'Mobile' ,
@@ -32,28 +35,43 @@ const viewports = {
3235// new globals based on theme?
3336// using sidebar as the styles for body for now 🤷
3437const GlobalStyle = createGlobalStyle `
35- ${ global } ;
38+
39+
3640 html body {
3741 font-family: 'Inter', sans-serif;
42+ -webkit-font-smoothing: auto;
43+ -moz-font-smoothing: auto;
44+ -moz-osx-font-smoothing: grayscale;
45+ -webkit-text-size-adjust: 100%;
46+ -webkit-tap-highlight-color: transparent;
47+ -webkit-touch-callout: none;
48+ font-smoothing: antialiased;
49+ text-rendering: optimizeLegibility;
50+ font-smooth: always;
51+ min-height: 100%;
52+ height: 100%;
53+ font-size: 16px;
3854 width: 400px;
3955 margin: 0;
40- background-color: ${ props =>
41- // @ts -ignore
42- props . theme . colors . sideBar . background } !important;
43- color: ${ props =>
44- // @ts -ignore
45- props . theme . colors . sideBar . foreground } !important;
56+ background-color: ${ ( { theme } : { theme : Theme } ) =>
57+ theme . colors . sideBar . background } ;
58+ color: ${ ( { theme } : { theme : Theme } ) => theme . colors . sideBar . foreground } ;
59+
4660 * {
4761 box-sizing: border-box;
4862 }
4963
64+ a {
65+ color: #40a9f3;
66+ }
67+
5068 }
5169` ;
5270const allThemes = getThemes ( ) ;
5371const vsCodeThemes = allThemes . map ( b => makeTheme ( b , b . name ) ) ;
5472
5573const blackCodesandbox = vsCodeThemes . find (
56- theme => theme . name === 'CodeSandbox Black'
74+ ( theme : Theme ) => theme . name === 'CodeSandbox Black'
5775) ;
5876
5977if ( ! isChromatic ( ) ) {
@@ -64,7 +82,9 @@ if (!isChromatic()) {
6482 </ >
6583 ) ;
6684
67- const rest = vsCodeThemes . filter ( theme => theme . name !== 'CodeSandbox Black' ) ;
85+ const rest = vsCodeThemes . filter (
86+ ( theme : Theme ) => theme . name !== 'CodeSandbox Black'
87+ ) ;
6888 addDecorator ( withGlobal ) ;
6989 addDecorator ( withThemesProvider ( [ blackCodesandbox , ...rest ] ) ) ;
7090} else {
0 commit comments