Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

Commit 22bfe7b

Browse files
authored
Merge pull request #69 from madou/improved-cross-fade
New animations, bug fixes
2 parents 49b97a8 + 30579a0 commit 22bfe7b

34 files changed

Lines changed: 1889 additions & 967 deletions

File tree

.storybook/addons.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'storybook-addon-jsx/register';
21
import '@storybook/addon-options/register';
32
import '@storybook/addon-notes/register';
43
import '@storybook/addon-links/register';

.storybook/config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { configure } from '@storybook/react';
2-
import JSXAddon from 'storybook-addon-jsx';
3-
import { setAddon } from '@storybook/react';
42
import { setOptions } from '@storybook/addon-options';
53

64
setOptions({
7-
name: 'yubaba',
5+
name: 'yubaba (back to github)',
86
url: 'https://github.com/madou/yubaba',
97
showStoriesPanel: true,
108
showAddonPanel: true,
@@ -13,5 +11,4 @@ setOptions({
1311

1412
const req = require.context('../packages', true, /.*stories\.tsx$/);
1513

16-
setAddon(JSXAddon);
1714
configure(() => req.keys().forEach(req), module);

packages/yubaba-common/src/SmallViewport.tsx

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import styled from 'styled-components';
3+
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
34

45
const PixelContainer = styled.div`
56
height: 100vh;
@@ -12,12 +13,19 @@ const PixelContainer = styled.div`
1213
font-family: Roboto, HelveticaNeue, Arial, sans-serif;
1314
user-select: none;
1415
position: relative;
16+
overflow: hidden;
17+
display: flex;
18+
flex-direction: column;
1519
1620
* {
1721
box-sizing: border-box;
1822
user-select: none;
1923
}
2024
25+
button::-moz-focus-inner {
26+
border: 0;
27+
}
28+
2129
ul {
2230
padding: 0;
2331
margin: 0;
@@ -37,14 +45,21 @@ const Toolbar = styled.div`
3745
background-color: rgba(0, 0, 0, 0.15);
3846
display: flex;
3947
align-items: center;
40-
z-index: 9999999;
4148
`;
4249

43-
const Square = styled.div`
50+
const ToolbarContainer = styled.div`
51+
z-index: 999999999;
52+
`;
53+
54+
interface SquareProps {
55+
invertColor: boolean;
56+
}
57+
58+
const Square = styled.div<SquareProps>`
4459
height: 12px;
4560
width: 12px;
4661
margin-left: auto;
47-
background-color: #000;
62+
background-color: ${props => (props.invertColor ? '#fff' : '#000')};
4863
margin-right: 9px;
4964
opacity: 0.35;
5065
`;
@@ -61,25 +76,58 @@ const Triangle = styled(Square)`
6176
background-color: transparent;
6277
border-left: 7px solid transparent;
6378
border-right: 7px solid transparent;
64-
border-top: 12px solid #000;
79+
border-top: 12px solid ${props => (props.invertColor ? '#fff' : '#000')};
80+
`;
81+
82+
const RelativeContainer = styled.div`
83+
position: relative;
84+
/* Hack to align contents to container taking off header height */
85+
height: calc(100% - 82px);
86+
87+
@media (min-width: 584px) {
88+
/* Hack to align contents to container taking off header height */
89+
height: calc(100% - 90px);
90+
}
6591
`;
6692

6793
interface SmallViewportProps {
6894
children: React.ReactNode;
95+
invertColor?: boolean;
96+
appBar?: React.ReactNode;
6997
}
7098

7199
export default class SmallViewport extends React.Component<SmallViewportProps> {
100+
theme = createMuiTheme({
101+
palette: {
102+
primary: {
103+
light: '#484848',
104+
main: '#212121',
105+
dark: '#000000',
106+
contrastText: '#fff',
107+
},
108+
},
109+
});
110+
72111
render() {
112+
const { invertColor, children, appBar } = this.props;
73113
return (
74-
<PixelContainer id="small-viewport">
75-
<Toolbar>
76-
<Square />
77-
<Circle />
78-
<Triangle />
79-
</Toolbar>
80-
81-
<OverflowContainer>{this.props.children}</OverflowContainer>
82-
</PixelContainer>
114+
<MuiThemeProvider theme={this.theme}>
115+
<PixelContainer>
116+
<ToolbarContainer>
117+
<Toolbar>
118+
<Square invertColor={!!invertColor} />
119+
<Circle invertColor={!!invertColor} />
120+
<Triangle invertColor={!!invertColor} />
121+
</Toolbar>
122+
123+
{appBar}
124+
</ToolbarContainer>
125+
126+
<RelativeContainer>
127+
<OverflowContainer>{children}</OverflowContainer>
128+
</RelativeContainer>
129+
</PixelContainer>
130+
</MuiThemeProvider>
83131
);
84132
}
85133
}

0 commit comments

Comments
 (0)