Skip to content

Commit c459344

Browse files
committed
fix(style): use 'rem' for font sizes
1 parent 851d204 commit c459344

File tree

17 files changed

+38
-51
lines changed

17 files changed

+38
-51
lines changed

src/components/Button/Button.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
createHatchedBackground,
1414
focusOutline
1515
} from '../common';
16-
import { blockSizes, fontSizes, padding } from '../common/system';
16+
import { blockSizes } from '../common/system';
1717

1818
const commonButtonStyles = css`
1919
position: relative;
@@ -23,8 +23,8 @@ const commonButtonStyles = css`
2323
height: ${({ size }) => blockSizes[size]};
2424
width: ${({ fullWidth, square, size }) =>
2525
fullWidth ? '100%' : square ? blockSizes[size] : 'auto'};
26-
padding: ${({ square }) => (square ? 0 : `0 calc(${padding.sm} + 2px)`)};
27-
font-size: ${fontSizes.md};
26+
padding: ${({ square }) => (square ? 0 : `0 10px`)};
27+
font-size: 1rem;
2828
user-select: none;
2929
&:active {
3030
padding-top: ${({ isDisabled }) => !isDisabled && '2px'};

src/components/Cutout/Cutout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const StyledCutout = styled.div`
77
position: relative;
88
box-sizing: border-box;
99
padding: 2px;
10-
10+
font-size: 1rem;
1111
border-style: solid;
1212
border-width: 2px;
1313
border-left-color: ${({ theme }) => theme.borderDark};

src/components/Fieldset/Fieldset.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ import propTypes from 'prop-types';
33

44
import styled, { css } from 'styled-components';
55
import { createDisabledTextStyles } from '../common';
6-
import { fontSizes, padding } from '../common/system';
76

87
const StyledFieldset = styled.fieldset`
98
position: relative;
109
border: 2px solid
1110
${({ theme, variant }) =>
1211
variant === 'flat' ? theme.flatDark : theme.borderLightest};
13-
padding: ${padding.md};
14-
margin-top: ${padding.sm};
15-
font-size: ${fontSizes.md};
12+
padding: 16px;
13+
margin-top: 8px;
14+
font-size: 1rem;
1615
color: ${({ theme }) => theme.text};
1716
${({ variant }) =>
1817
variant !== 'flat' &&
@@ -26,11 +25,11 @@ const StyledLegend = styled.legend`
2625
display: flex;
2726
position: absolute;
2827
top: 0;
29-
left: ${padding.sm};
28+
left: 8px;
3029
transform: translateY(calc(-50% - 2px));
31-
padding: 0 ${padding.sm};
30+
padding: 0 8px;
3231
33-
font-size: ${fontSizes.md};
32+
font-size: 1rem;
3433
background: ${({ theme, variant }) =>
3534
variant === 'flat' ? theme.canvas : theme.material};
3635
`;

src/components/ListItem/ListItem.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
55
import { createDisabledTextStyles } from '../common';
6-
import { padding, blockSizes } from '../common/system';
6+
import { blockSizes } from '../common/system';
77

88
export const StyledListItem = styled.li`
99
box-sizing: border-box;
@@ -13,8 +13,8 @@ export const StyledListItem = styled.li`
1313
position: relative;
1414
height: ${props => blockSizes[props.size]};
1515
width: ${props => (props.square ? blockSizes[props.size] : 'auto')};
16-
padding: 0 ${padding.sm};
17-
16+
padding: 0 8px;
17+
font-size: 1rem;
1818
white-space: nowrap;
1919
justify-content: ${props =>
2020
props.square ? 'space-around' : 'space-between'};

src/components/Select/Select.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styled, { css } from 'styled-components';
55
import Button from '../Button/Button';
66

77
import { shadow as commonShadow, createFlatBoxStyles } from '../common';
8-
import { blockSizes, fontSizes, padding } from '../common/system';
8+
import { blockSizes } from '../common/system';
99
import Cutout from '../Cutout/Cutout';
1010

1111
const sharedWrapperStyles = css`
@@ -15,7 +15,7 @@ const sharedWrapperStyles = css`
1515
justify-content: space-between;
1616
background: ${({ theme }) => theme.canvas};
1717
color: ${({ theme }) => theme.inputText};
18-
font-size: ${fontSizes.md};
18+
font-size: 1rem;
1919
`;
2020
const StyledSelectWrapper = styled(Cutout)`
2121
${sharedWrapperStyles}
@@ -26,7 +26,7 @@ const StyledFlatSelectWrapper = styled.div`
2626
`;
2727
const StyledSelectContent = styled.div`
2828
width: 100%;
29-
padding-left: ${padding.sm};
29+
padding-left: 8px;
3030
overflow: hidden;
3131
white-space: nowrap;
3232
`;
@@ -71,7 +71,7 @@ const StyledDropdownIcon = styled.span`
7171
const StyledDropdownList = styled.ul`
7272
box-sizing: border-box;
7373
74-
font-size: ${fontSizes.md};
74+
font-size: 1rem;
7575
position: absolute;
7676
transform: translateY(100%);
7777
left: 0px;
@@ -99,11 +99,11 @@ const StyledDropdownListItem = styled.li`
9999
box-sizing: border-box;
100100
101101
width: 100%;
102-
padding-left: ${padding.sm};
102+
padding-left: 8px;
103103
104104
height: calc(${blockSizes.md} - 4px);
105105
line-height: calc(${blockSizes.md} - 4px);
106-
font-size: ${fontSizes.md};
106+
font-size: 1rem;
107107
white-space: nowrap;
108108
overflow: hidden;
109109
text-overflow: ellipsis;

src/components/SwitchBase/SwitchBase.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import styled, { css } from 'styled-components';
22
import { createDisabledTextStyles, focusOutline } from '../common';
33

4-
import { padding, fontSizes } from '../common/system';
54
import { StyledListItem } from '../ListItem/ListItem';
65

76
export const size = 20;
@@ -20,13 +19,13 @@ export const StyledLabel = styled.label`
2019
display: inline-flex;
2120
align-items: center;
2221
position: relative;
23-
margin: ${padding.sm} 0;
22+
margin: 8px 0;
2423
cursor: pointer;
2524
-webkit-user-select: none;
2625
-moz-user-select: none;
2726
-ms-user-select: none;
2827
user-select: none;
29-
font-size: ${fontSizes.md};
28+
font-size: 1rem;
3029
color: ${({ theme }) => theme.text};
3130
${props => props.isDisabled && createDisabledTextStyles()}
3231

src/components/Tab/Tab.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
55
import { createBorderStyles, createBoxStyles, focusOutline } from '../common';
6-
import { blockSizes, padding } from '../common/system';
6+
import { blockSizes } from '../common/system';
77

88
const StyledTab = styled.button`
99
${createBoxStyles()}
@@ -15,7 +15,7 @@ const StyledTab = styled.button`
1515
font-size: 1rem;
1616
height: ${blockSizes.md};
1717
line-height: ${blockSizes.md};
18-
padding: 0 ${padding.sm};
18+
padding: 0 8px;
1919
border-bottom: none;
2020
border-top-left-radius: 5px;
2121
border-top-right-radius: 5px;
@@ -41,7 +41,7 @@ const StyledTab = styled.button`
4141
height: calc(${blockSizes.md} + 4px);
4242
top: -3px;
4343
margin-bottom: -6px;
44-
padding: 0 calc(${padding.sm} + 8px);
44+
padding: 0 16px;
4545
margin-left: -8px;
4646
margin-right: -8px;
4747
`}

src/components/TabBody/TabBody.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
55
import { createBorderStyles, createBoxStyles } from '../common';
6-
import { padding } from '../common/system';
76

87
const StyledTabBody = styled.div`
98
${createBoxStyles()}
109
${createBorderStyles()}
1110
position: relative;
1211
display: block;
1312
height: 100%;
14-
padding: ${padding.md};
13+
padding: 16px;
14+
font-size: 1rem;
1515
`;
1616
const TabBody = React.forwardRef(function TabBody(props, ref) {
1717
const { children, ...otherProps } = props;

src/components/Table/Table.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const StyledTable = styled.table`
99
width: 100%;
1010
border-collapse: collapse;
1111
border-spacing: 0;
12+
font-size: 1rem;
1213
`;
1314

1415
const StyledCutout = styled(Cutout)`

src/components/TableDataCell/TableDataCell.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import React from 'react';
22
import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
5-
import { padding } from '../common/system';
65

76
const StyledTd = styled.td`
8-
padding: 0 ${padding.sm};
7+
padding: 0 8px;
98
`;
109
const TableDataCell = React.forwardRef(function TableDataCell(props, ref) {
1110
const { children, ...otherProps } = props;

src/components/TableHeadCell/TableHeadCell.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import propTypes from 'prop-types';
33

44
import styled, { css } from 'styled-components';
55
import { createBorderStyles, createDisabledTextStyles } from '../common';
6-
import { padding } from '../common/system';
76

87
const StyledHeadCell = styled.th`
98
position: relative;
10-
padding: 0 ${padding.sm};
9+
padding: 0 8px;
1110
display: table-cell;
1211
vertical-align: inherit;
1312
background: ${({ theme }) => theme.material};

src/components/TextArea/TextArea.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
55
import { createDisabledTextStyles, createFlatBoxStyles } from '../common';
6-
import { blockSizes, fontSizes, padding, fontFamily } from '../common/system';
6+
import { blockSizes, fontFamily } from '../common/system';
77
import Cutout from '../Cutout/Cutout';
88

99
const StyledTextAreaWrapper = styled(Cutout)`
@@ -22,12 +22,12 @@ const StyledTextArea = styled.textarea`
2222
width: 100%;
2323
height: 100%;
2424
box-sizing: border-box;
25-
padding: ${padding.sm};
25+
padding: 8px;
2626
outline: none;
2727
border: none;
2828
background: none;
2929
resize: none;
30-
font-size: ${fontSizes.md};
30+
font-size: 1rem;
3131
font-family: ${fontFamily};
3232
3333
${({ disabled, variant }) =>

src/components/TextField/TextField.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
55
import { createDisabledTextStyles, createFlatBoxStyles } from '../common';
6-
import { blockSizes, fontSizes, padding, fontFamily } from '../common/system';
6+
import { blockSizes, fontFamily } from '../common/system';
77
import Cutout from '../Cutout/Cutout';
88

99
const StyledWrapper = styled(Cutout)`
@@ -20,11 +20,11 @@ export const StyledTextInput = styled.input`
2020
box-sizing: border-box;
2121
width: 100%;
2222
height: 100%;
23-
padding: 0 ${padding.sm};
23+
padding: 0 8px;
2424
outline: none;
2525
border: none;
2626
background: none;
27-
font-size: ${fontSizes.md};
27+
font-size: 1rem;
2828
font-family: ${fontFamily};
2929
color: ${({ theme }) => theme.inputText};
3030
${({ disabled, variant }) =>

src/components/Tooltip/Tooltip.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const Tip = styled.span`
1616
background: ${({ theme }) => theme.tooltip};
1717
box-shadow: ${shadow};
1818
text-align: center;
19+
font-size: 1rem;
1920
`;
2021

2122
const Wrapper = styled.div`

src/components/Window/Window.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { createBorderStyles, createBoxStyles } from '../common';
77
const StyledWindow = styled.div`
88
position: relative;
99
padding: 4px;
10+
font-size: 1rem;
1011
${createBorderStyles({ windowBorders: true })}
1112
${createBoxStyles()}
1213
`;

src/components/WindowContent/WindowContent.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import React from 'react';
22
import propTypes from 'prop-types';
33

44
import styled from 'styled-components';
5-
import { padding } from '../common/system';
65

76
const StyledWindowContent = styled.div`
8-
padding: ${padding.md};
7+
padding: 16px;
98
margin-right: 2px;
109
`;
1110

src/components/common/system.js

-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
// TODO - implement styled-system
22

3-
export const fontSizes = {
4-
sm: '15px',
5-
md: '16px',
6-
lg: '17px'
7-
};
8-
93
export const blockSizes = {
104
sm: '27px',
115
md: '35px',
126
lg: '43px'
137
};
14-
export const padding = {
15-
sm: '0.5rem',
16-
md: '1rem',
17-
lg: '1.25rem'
18-
};
198

209
export const fontFamily = 'sans-serif';

0 commit comments

Comments
 (0)