Skip to content

Commit 0bd2512

Browse files
committed
fix: global styles overflow
1 parent d627e34 commit 0bd2512

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "pwa-chrome",
9+
"request": "launch",
10+
"name": "Launch Chrome against localhost",
11+
"url": "http://localhost:8080",
12+
"webRoot": "${workspaceFolder}"
13+
}
14+
]
15+
}

example/src/stories/Container.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export default {
1818
control: { type: 'select', options: ['none', 'normal', 'wide'] },
1919
description: 'The padding of the container',
2020
},
21+
topBarPadding: {
22+
control: 'boolean',
23+
description: 'Whether to include top navigation bar padding or not',
24+
},
2125
as: {
2226
control: { type: 'select', options: ['div', 'span', 'button', 'a'] },
2327
description: 'The element to render the container as',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solved-ac/ui-react",
3-
"version": "0.0.1-alpha.31",
3+
"version": "0.0.1-alpha.32",
44
"description": "React component library used by solved.ac",
55
"author": "shiftpsh",
66
"license": "MIT",

src/components/Container.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,28 @@ const paddingMap = {
2020

2121
interface ContainerContainerProps {
2222
padding: 'none' | 'normal' | 'wide'
23+
topBarPadding: boolean
2324
}
2425

2526
const ContainerContainer = styled.nav<ContainerContainerProps>`
2627
max-width: ${v.width};
2728
${({ padding }) => paddingMap[padding]}
29+
${({ topBarPadding }) => topBarPadding && 'padding-top: 48px;'}
2830
margin: 0 auto;
2931
`
3032

3133
export interface ContainerProps {
3234
w?: string | number
3335
padding?: 'none' | 'normal' | 'wide'
36+
topBarPadding?: boolean
3437
}
3538

3639
export const Container: PC<'div', ContainerProps> = React.forwardRef(
3740
<T extends ElementType>(props: PP<T, ContainerProps>, ref?: PR<T>) => {
3841
const {
3942
w = '1200px',
4043
padding = 'normal',
44+
topBarPadding = false,
4145
style,
4246
as = 'div',
4347
...rest
@@ -48,6 +52,7 @@ export const Container: PC<'div', ContainerProps> = React.forwardRef(
4852
ref={ref}
4953
as={as}
5054
padding={padding}
55+
topBarPadding={topBarPadding}
5156
style={{
5257
[vars.width]: typeof w === 'string' ? w : `${w}px`,
5358
...style,

src/styles/GlobalStyles.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const SolvedGlobalStyles = createGlobalStyle<{ theme: SolvedTheme }>`
3737
font-family: ${({ theme }) => theme.typography.paragraph};
3838
font-weight: 400;
3939
width: 100%;
40-
overflow-x: hidden;
4140
background: ${({ theme }) => theme.color.background.footer};
4241
${({ theme }) =>
4342
componentGlobalStyles.map((fn) => fn(theme)).join('\n')}
@@ -47,7 +46,6 @@ export const SolvedGlobalStyles = createGlobalStyle<{ theme: SolvedTheme }>`
4746
margin: 0;
4847
width: 100%;
4948
line-height: 1.6;
50-
overflow-x: hidden;
5149
color: ${({ theme }) => theme.color.text.primary.main};
5250
background: ${({ theme }) => theme.color.background.page};
5351
scrollbar-width: thin;
@@ -128,30 +126,6 @@ export const SolvedGlobalStyles = createGlobalStyle<{ theme: SolvedTheme }>`
128126
overflow: hidden !important;
129127
}
130128
131-
/* TODO remove named classes */
132-
.contents {
133-
position: relative;
134-
margin: 48px auto 0px auto;
135-
padding: 16px;
136-
max-width: min(100vw, 1200px);
137-
@media screen and (max-width: 540px) {
138-
padding: 16px 12px;
139-
}
140-
&.no_top_margin {
141-
margin-top: 0;
142-
}
143-
&.no-padding {
144-
padding: 0;
145-
}
146-
}
147-
148-
/* TODO remove named classes */
149-
.solvedac-centering {
150-
position: relative;
151-
margin: 0 auto;
152-
max-width: 1200px;
153-
}
154-
155129
/* TODO remove named classes */
156130
.bronze {
157131
color: #ad5600;

0 commit comments

Comments
 (0)