Skip to content

Commit 4c1866d

Browse files
committed
wip
1 parent 87643c0 commit 4c1866d

File tree

4 files changed

+54
-13
lines changed

4 files changed

+54
-13
lines changed

packages/graphiql/src/new-components/Layout.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { jsx } from 'theme-ui';
33

44
import PropTypes from 'prop-types';
55

6+
const Widget = ({ children }) => <div sx={{ padding: 2 }}>{children}</div>
7+
68
const Container = ({ children, mini = false }) => <div sx={
79
{
8-
padding: 2,
910
backgroundColor: !mini && 'cardBackground',
1011
boxShadow: !mini && (theme => `0 0 0 .1px ${theme.colors.border}, 0 1px 4px 0 ${theme.colors.border}`)
1112
}}>
@@ -16,22 +17,22 @@ Container.propTypes = {
1617
mini: PropTypes.bool
1718
}
1819

19-
const Layout = ({ nav = <marquee>{'Helloooo'}</marquee> }) => {
20+
const Layout = ({ nav = 'nav' }) => {
2021
return (
2122
<main
2223
sx={{
2324
display: 'grid',
2425
gap: 2,
25-
backgroundColor: 'background',
2626
padding: 2,
2727
gridAutoFlow: 'column',
2828
gridTemplateColumns: '6em',
29-
gridAutoColumns: '1fr',
30-
minHeight: '100%'
29+
gridAutoColumns: 'minmax(30em, 1fr)',
30+
minHeight: '100vh',
3131
}}>
3232
<Container mini>{nav}</Container>
33-
<Container>{'container'}</Container>
34-
<Container>{'container'}</Container>
33+
<Container><Widget>{'container'}</Widget></Container>
34+
<Container><Widget>{'container'}</Widget></Container>
35+
<Container><Widget>{'container'}</Widget></Container>
3536
</main>
3637
);
3738
};
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
22
import Layout from './Layout';
3+
import Nav from './Nav';
34

45
export default { title: 'Layout' };
56

67
export const withDefaultSlots = () => <Layout />;
78

8-
export const withCustomSlots = () => <Layout nav={<nav>{'hi'}</nav>} />;
9+
export const withCustomSlots = () => <Layout nav={<Nav />} />;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/** @jsx jsx */
2+
import { jsx } from 'theme-ui';
3+
4+
const Item = ({ children }) => <button sx={
5+
{
6+
display: 'flex',
7+
alignItems: 'center',
8+
justifyContent: 'center',
9+
cursor: 'pointer',
10+
transition: '.2s',
11+
':hover': {
12+
transform: 'scale(1.1)'
13+
},
14+
':active': {
15+
transform: 'scale(.95)'
16+
}
17+
}}>
18+
{children}
19+
</button>
20+
21+
22+
const Nav = () => {
23+
return (
24+
<nav
25+
sx={{
26+
display: 'grid',
27+
gridAutoFlow: 'row',
28+
gridAutoRows: '2em',
29+
fontSize: '3em'
30+
}}>
31+
<Item>{'🐽'}</Item>
32+
<Item>{'👨‍🌾'}</Item>
33+
<Item>{'🐝'}</Item>
34+
</nav>
35+
);
36+
};
37+
38+
export default Nav;

packages/graphiql/src/new-components/theme.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ export default {
1818
};
1919

2020
export const Reset = () => <Global styles={theme => ({
21-
body: {
21+
'*': {
2222
margin: '0',
23-
fontFamily: theme.fonts.body,
24-
color: theme.colors.text
23+
boxSizing: 'border-box'
2524
},
26-
'h1, h2, h3, h4, h5, h6': {
27-
margin: 0,
25+
body: {
26+
fontFamily: theme.fonts.body,
27+
color: theme.colors.text,
28+
backgroundColor: theme.colors.background,
2829
},
2930
small: {
3031
fontSize: '100%',

0 commit comments

Comments
 (0)