Skip to content

Commit 12762a2

Browse files
theetrainmarcod1419
authored andcommitted
chore(docs): use styled-components on styleguidist
1 parent e99aaab commit 12762a2

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

docs/components/overrides/StyleGuide/StyleGuideRenderer.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@ import Styled from 'rsg-components/Styled'
44
import cx from 'classnames'
55
import Logo from 'rsg-components/Logo'
66
import Markdown from 'rsg-components/Markdown'
7+
import { createGlobalStyle } from 'styled-components'
78

9+
import CSSReset from '@tds/core-css-reset'
810
import FlexGrid from '@tds/core-flex-grid'
911

12+
const GlobalStyleGuide = createGlobalStyle({
13+
// Full width container with limited with parent: https://css-tricks.com/full-width-containers-limited-width-parents/
14+
// Only activate with there is no sidebar
15+
'.rsg--root-1:not(*[class*=\'rsg--hasSidebar\']) .docs_full-width-playground': {
16+
width: '100vw',
17+
position: 'relative',
18+
left: '50%',
19+
right: '50%',
20+
marginLeft: '-50vw',
21+
marginRight: '-50vw',
22+
}
23+
})
24+
1025
const styles = ({ color, fontFamily, fontSize, sidebarWidth, mq, space, maxWidth }) => ({
1126
root: {
1227
backgroundColor: color.baseBackground,
@@ -77,20 +92,23 @@ export function StyleGuideRenderer({ classes, title, homepageUrl, children, toc,
7792
)
7893

7994
return (
80-
<div className={cx(classes.root, hasSidebar && classes.hasSidebar)}>
81-
<a id="styleguidist-top">&nbsp;</a>
95+
<>
96+
<CSSReset />
97+
<div className={cx(classes.root, hasSidebar && classes.hasSidebar)}>
98+
<a id="styleguidist-top">&nbsp;</a>
8299

83-
{hasSidebar ? main : <TdsGrid>{main}</TdsGrid>}
100+
{hasSidebar ? main : <TdsGrid>{main}</TdsGrid>}
84101

85-
{hasSidebar && (
86-
<div className={classes.sidebar}>
87-
<div className={classes.logo}>
88-
<Logo>{title}</Logo>
102+
{hasSidebar && (
103+
<div className={classes.sidebar}>
104+
<div className={classes.logo}>
105+
<Logo>{title}</Logo>
106+
</div>
107+
{toc}
89108
</div>
90-
{toc}
91-
</div>
92-
)}
93-
</div>
109+
)}
110+
</div>
111+
</>
94112
)
95113
}
96114

docs/scss/styleguide.scss

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)