Skip to content

Commit 0877d39

Browse files
committed
🚧 split components into files
1 parent bdedc63 commit 0877d39

File tree

5 files changed

+79
-46
lines changed

5 files changed

+79
-46
lines changed

client/components/mobile/Footer.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import { prop, remSize } from '../../theme';
4+
5+
const background = prop('Button.default.background');
6+
const textColor = prop('primaryTextColor');
7+
8+
const Footer = styled.div`
9+
position: fixed;
10+
width: 100%;
11+
background: ${background};
12+
color: ${textColor};
13+
padding: ${remSize(12)};
14+
padding-left: ${remSize(32)};
15+
z-index: 1;
16+
17+
bottom: 0;
18+
`;
19+
20+
export default Footer;

client/components/mobile/Header.jsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import { prop, remSize } from '../../theme';
4+
5+
const background = prop('Button.default.background');
6+
const textColor = prop('primaryTextColor');
7+
8+
const Header = styled.div`
9+
position: fixed;
10+
width: 100%;
11+
background: ${background};
12+
color: ${textColor};
13+
padding: ${remSize(12)};
14+
padding-left: ${remSize(32)};
15+
padding-right: ${remSize(32)};
16+
z-index: 1;
17+
18+
display: flex;
19+
flex: 1;
20+
flex-direction: row;
21+
justify-content: flex-start;
22+
align-items: center;
23+
`;
24+
25+
export default Header;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import { prop, remSize } from '../../theme';
4+
5+
const textColor = prop('primaryTextColor');
6+
7+
const IconButton = styled.button`
8+
width: 3rem;
9+
> svg {
10+
width: 100%;
11+
height: auto;
12+
fill: ${textColor};
13+
stroke: ${textColor};
14+
}
15+
`;
16+
17+
export default IconButton;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
const Screen = ({ children }) => (
5+
<div className="fullscreen-preview">
6+
{children}
7+
</div>
8+
);
9+
Screen.propTypes = {
10+
children: PropTypes.node.isRequired
11+
};
12+
13+
export default Screen;

client/modules/IDE/pages/IDEViewMobile.jsx

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -26,61 +26,19 @@ import { CloseIcon } from '../../../common/Icons';
2626
import PreferencesIcon from '../../../images/preferences.svg';
2727
import PlayIcon from '../../../images/triangle-arrow-right.svg';
2828

29+
import IconButton from '../../../components/mobile/IconButton';
30+
import Header from '../../../components/mobile/Header';
31+
import Screen from '../../../components/mobile/MobileScreen';
32+
import Footer from '../../../components/mobile/Footer';
2933

3034
const background = prop('Button.default.background');
3135
const textColor = prop('primaryTextColor');
3236

33-
34-
const Header = styled.div`
35-
position: fixed;
36-
width: 100%;
37-
background: ${background};
38-
color: ${textColor};
39-
padding: ${remSize(12)};
40-
padding-left: ${remSize(32)};
41-
padding-right: ${remSize(32)};
42-
z-index: 1;
43-
44-
display: flex;
45-
flex: 1;
46-
flex-direction: row;
47-
justify-content: flex-start;
48-
align-items: center;
49-
`;
50-
51-
const Footer = styled.div`
52-
position: fixed;
53-
width: 100%;
54-
background: ${background};
55-
color: ${textColor};
56-
padding: ${remSize(12)};
57-
padding-left: ${remSize(32)};
58-
z-index: 1;
59-
60-
bottom: 0;
61-
`;
62-
6337
const Content = styled.div`
6438
z-index: 0;
6539
margin-top: ${remSize(16)};
6640
`;
6741

68-
const IconButton = styled.button`
69-
width: 3rem;
70-
> svg {
71-
width: 100%;
72-
height: auto;
73-
}
74-
`;
75-
76-
const Screen = ({ children }) => (
77-
<div className="fullscreen-preview">
78-
{children}
79-
</div>
80-
);
81-
Screen.propTypes = {
82-
children: PropTypes.node.isRequired
83-
};
8442

8543
const isUserOwner = ({ project, user }) => (project.owner && project.owner.id === user.id);
8644

0 commit comments

Comments
 (0)