File size: 5,317 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
// @flow
import styled from 'styled-components';
import theme from 'shared/theme';
export const NAVBAR_WIDTH = 72;
export const NAVBAR_EXPANDED_WIDTH = 256;
export const MIN_PRIMARY_COLUMN_WIDTH = 600;
export const MIN_SECONDARY_COLUMN_WIDTH = 320;
export const MAX_PRIMARY_COLUMN_WIDTH = 968;
export const MAX_SECONDARY_COLUMN_WIDTH = 400;
export const COL_GAP = 24;
export const TITLEBAR_HEIGHT = 62;
export const MIN_MAX_WIDTH =
MIN_PRIMARY_COLUMN_WIDTH + MIN_SECONDARY_COLUMN_WIDTH + COL_GAP;
export const MAX_WIDTH =
MAX_PRIMARY_COLUMN_WIDTH + MAX_SECONDARY_COLUMN_WIDTH + COL_GAP;
export const MIN_WIDTH_TO_EXPAND_NAVIGATION = MAX_WIDTH + 256;
export const SINGLE_COLUMN_WIDTH = MAX_WIDTH;
// add 144 (72 * 2) to account for the left side nav
export const MEDIA_BREAK =
MIN_PRIMARY_COLUMN_WIDTH +
MIN_SECONDARY_COLUMN_WIDTH +
COL_GAP +
NAVBAR_WIDTH * 2;
/*
do not remove this className.
see `src/routes.js` for an explanation of what's going on here
*/
export const ViewGrid = styled.main.attrs({
id: 'main',
className: 'view-grid',
})`
display: grid;
grid-area: main;
height: 100%;
max-height: calc(100vh - 48px);
overflow: hidden;
overflow-y: auto;
@media (max-width: ${MEDIA_BREAK}px) {
max-height: calc(100vh - ${TITLEBAR_HEIGHT}px - 48px);
}
`;
/*
ββββ¬βββββββββ¬βββ
β β xx β β
β β β β
β β xx β β
β β β β
β β xx β β
ββββ΄βββββββββ΄βββ
*/
export const SingleColumnGrid = styled.div`
display: grid;
justify-self: center;
grid-template-columns: ${MIN_MAX_WIDTH}px;
grid-template-areas: 'primary';
background: ${theme.bg.default};
overflow-y: auto;
@media (max-width: ${MEDIA_BREAK}px) {
width: 100%;
max-width: 100%;
grid-template-columns: 1fr;
border-left: 0;
border-right: 0;
}
`;
/*
ββββ¬βββββ¬ββ¬ββ¬βββ
β β xx β βxβ β
β β β β β β
β β xx β βxβ β
β β β β β β
β β xx β βxβ β
ββββ΄βββββ΄ββ΄ββ΄βββ
*/
export const PrimarySecondaryColumnGrid = styled.div`
display: grid;
justify-self: center;
grid-template-columns:
minmax(${MIN_PRIMARY_COLUMN_WIDTH}px, ${MAX_PRIMARY_COLUMN_WIDTH}px)
minmax(${MIN_SECONDARY_COLUMN_WIDTH}px, ${MAX_SECONDARY_COLUMN_WIDTH}px);
grid-template-rows: 100%;
grid-template-areas: 'primary secondary';
grid-gap: ${COL_GAP}px;
max-width: ${MAX_WIDTH}px;
@media (max-width: ${MEDIA_BREAK}px) {
grid-template-columns: 1fr;
grid-template-rows: min-content 1fr;
grid-gap: 0;
min-width: 100%;
}
`;
/*
ββββ¬ββ¬ββ¬βββββ¬βββ
β βxβ β xx β β
β β β β β β
β βxβ β xx β β
β β β β β β
β βxβ β xx β β
ββββ΄ββ΄ββ΄βββββ΄βββ
*/
export const SecondaryPrimaryColumnGrid = styled.div`
display: grid;
justify-self: center;
grid-template-columns:
minmax(${MIN_SECONDARY_COLUMN_WIDTH}px, ${MAX_SECONDARY_COLUMN_WIDTH}px)
minmax(${MIN_PRIMARY_COLUMN_WIDTH}px, ${MAX_PRIMARY_COLUMN_WIDTH}px);
grid-template-rows: 100%;
grid-template-areas: 'secondary primary';
grid-gap: ${COL_GAP}px;
max-width: ${MAX_WIDTH}px;
margin: 0 24px;
@media (max-width: ${MEDIA_BREAK}px) {
grid-template-columns: 1fr;
grid-template-rows: 1fr;
grid-gap: 0;
min-width: 100%;
max-width: 100%;
}
`;
/*
βββββββββββββββ
β β
β βββββ β
β β x β β
β βββββ β
β β
βββββββββββββββ
*/
export const CenteredGrid = styled.div`
display: grid;
justify-self: center;
grid-template-columns: ${MAX_WIDTH}px;
align-self: center;
max-width: ${MAX_PRIMARY_COLUMN_WIDTH}px;
grid-template-columns: minmax(
${MIN_PRIMARY_COLUMN_WIDTH}px,
${MAX_PRIMARY_COLUMN_WIDTH}px
);
@media (max-width: ${MEDIA_BREAK}px) {
align-self: flex-start;
width: 100%;
max-width: 100%;
grid-template-columns: 1fr;
height: calc(100vh - ${TITLEBAR_HEIGHT}px - 48px);
}
`;
export const PrimaryColumn = styled.section`
border-left: 1px solid ${theme.bg.border};
border-right: 1px solid ${theme.bg.border};
border-bottom: 1px solid ${theme.bg.border};
border-radius: 0 0 4px 4px;
height: 100%;
max-width: ${props =>
!props.fullWidth ? `${MAX_PRIMARY_COLUMN_WIDTH}px` : 'none'};
grid-area: primary;
display: grid;
grid-template-rows: 1fr;
@media (max-width: ${MEDIA_BREAK}px) {
border-left: 0;
border-right: 0;
border-bottom: 0;
grid-column-start: 1;
max-width: 100vw;
height: calc(100vh - ${TITLEBAR_HEIGHT}px - 48px);
}
`;
export const SecondaryColumn = styled.section`
height: calc(100vh - 48px);
overflow: hidden;
overflow-y: auto;
position: sticky;
top: 0;
padding-bottom: 48px;
grid-area: secondary;
&::-webkit-scrollbar {
width: 0px;
height: 0px;
background: transparent; /* make scrollbar transparent */
}
@media (max-width: ${MEDIA_BREAK}px) {
height: calc(100vh - ${TITLEBAR_HEIGHT}px - 48px);
display: none;
}
`;
|