Skip to content

Commit c42a713

Browse files
committed
Make the panel width a variable
1 parent 8901f62 commit c42a713

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/components/Body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import Results from 'components/Results'
1313
import Typography from 'components/Typography'
1414

1515
const ContentWrapper = styled.div`
16-
width: ${({ isRightPanelOpen }) =>
17-
isRightPanelOpen ? 'calc(100% - 430px)' : '100%'};
16+
width: ${({ isRightPanelOpen, theme }) =>
17+
isRightPanelOpen ? `calc(100% - ${theme.sizes.rightPanel})` : '100%'};
1818
transition: width 0.3s ease-in-out;
1919
`
2020

src/components/RightPanel.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const PanelWrapper = styled.div`
1212
position: fixed;
1313
top: 0;
1414
right: 0;
15-
width: 430px;
15+
width: ${(p) => p.theme.sizes.rightPanel};
1616
height: 100vh;
1717
background: ${(p) => p.theme.colors.white};
1818
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
@@ -128,7 +128,6 @@ const CloudCardLink = styled(Link)`
128128
text-decoration: none;
129129
}
130130
`
131-
132131
const RightPanel = ({ isOpen, onClose }) => (
133132
<PanelWrapper isOpen={isOpen} data-testid="right-panel">
134133
<Header>

src/theme.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const theme = {
4242
},
4343
// 0, 1, 2, 3, 4, 5, 6, 7, 8
4444
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
45+
sizes: {
46+
rightPanel: '430px',
47+
},
4548
fontSizes: [12, 14, 16, 20, 24, 32, 48, 64, 72],
4649
breakpoints: {
4750
large: '1440',

0 commit comments

Comments
 (0)