Skip to content

Commit

Permalink
fix: add global css vars
Browse files Browse the repository at this point in the history
  • Loading branch information
DiRaiks committed Jul 10, 2024
1 parent 93424a7 commit daadcf4
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 56 deletions.
4 changes: 1 addition & 3 deletions features/ipfs/rpc-availability-check-result-box/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
themeDefault,
} from '@lidofinance/lido-ui';

import { NAV_MOBILE_MEDIA } from 'styles/constants';

type TextProps = Omit<ComponentProps<typeof TextOriginal>, 'color'> & {
color?: keyof typeof themeDefault.colors;
};
Expand Down Expand Up @@ -38,7 +36,7 @@ export const Wrap = styled.div`
border-radius: 2px 0 0 0;
background: var(--lido-color-accent);
${NAV_MOBILE_MEDIA} {
@media screen and (max-width: var(--nav-mobile-max-width)) {
display: none;
}
}
Expand Down
25 changes: 8 additions & 17 deletions shared/components/layout/footer/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import styled from 'styled-components';
import { Container, Link } from '@lidofinance/lido-ui';

import { LogoLido } from 'shared/components/logos/logos';
import {
FOOTER_DESKTOP_PADDING_X,
FOOTER_DESKTOP_PADDING_Y,
FOOTER_MAX_WIDTH,
FOOTER_MOBILE_MARGIN_BOTTOM,
FOOTER_MOBILE_PADDING_X,
FOOTER_MOBILE_PADDING_Y,
NAV_MOBILE_MEDIA,
} from 'styles/constants';

import { ReactComponent as ExternalLinkIcon } from 'assets/icons/external-link-icon.svg';

Expand All @@ -23,12 +14,12 @@ export const FooterStyle = styled(Container)`
flex-wrap: wrap;
width: 100%;
max-width: ${FOOTER_MAX_WIDTH}px;
padding: ${FOOTER_DESKTOP_PADDING_Y}px ${FOOTER_DESKTOP_PADDING_X}px;
max-width: var(--footer-max-width);
padding: var(--footer-desktop-padding-y) var(--footer-desktop-padding-x);
${NAV_MOBILE_MEDIA} {
margin-bottom: ${FOOTER_MOBILE_MARGIN_BOTTOM}px;
padding: ${FOOTER_MOBILE_PADDING_X}px ${FOOTER_MOBILE_PADDING_Y}px;
@media screen and (max-width: var(--nav-mobile-max-width)) {
margin-bottom: var(--footer-mobile-margin-bottom);
padding: var(--footer-mobile-padding-x) var(--footer-mobile-padding-y);
justify-content: center;
}
`;
Expand Down Expand Up @@ -83,13 +74,13 @@ export const LogoLidoStyle = styled(LogoLido)`
export const FooterDivider = styled.div`
position: absolute;
top: 0;
left: ${FOOTER_DESKTOP_PADDING_X}px;
width: calc(100% - ${FOOTER_DESKTOP_PADDING_X * 2}px);
left: var(--footer-desktop-padding-x);
width: calc(100% - var(--footer-desktop-padding-x) * 2);
height: 1px;
background: var(--lido-color-popupMenuItemBgActiveHover);
opacity: 0.12;
${NAV_MOBILE_MEDIA} {
@media screen and (max-width: var(--nav-mobile-max-width)) {
display: none;
}
`;
Expand Down
14 changes: 4 additions & 10 deletions shared/components/layout/header/components/navigation/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import styled, { css } from 'styled-components';

import {
NAV_MOBILE_MEDIA,
NAV_MOBILE_HEIGHT,
NAV_DESKTOP_GUTTER_X,
} from 'styles/constants';

export const desktopCss = css`
margin: 0 ${NAV_DESKTOP_GUTTER_X}px;
margin: 0 var(--nav-desktop-gutter-x);
display: flex;
gap: ${({ theme }) => theme.spaceMap.xxl}px;
Expand All @@ -30,7 +24,7 @@ const mobileCss = css`
justify-content: space-around;
align-items: center;
border-top: 1px solid var(--lido-color-border);
height: calc(${NAV_MOBILE_HEIGHT}px + env(safe-area-inset-bottom));
height: calc(var(--nav-mobile-height) + env(safe-area-inset-bottom));
svg {
margin-right: 0;
Expand All @@ -41,7 +35,7 @@ const mobileCss = css`
export const Nav = styled.div`
${desktopCss}
// mobile kicks in on a bit higher width for nav
${NAV_MOBILE_MEDIA} {
@media screen and (max-width: var(--nav-mobile-max-width)) {
${mobileCss}
}
z-index: 6;
Expand Down Expand Up @@ -75,7 +69,7 @@ export const NavLink = styled.span<{ active: boolean }>`
active ? `var(--lido-color-primary)` : `var(--lido-color-secondary)`};
}
${NAV_MOBILE_MEDIA} {
@media screen and (max-width: var(--nav-mobile-max-width)) {
width: ${({ theme }) => theme.spaceMap.xl}px;
flex-direction: column;
text-transform: none;
Expand Down
12 changes: 5 additions & 7 deletions shared/components/layout/header/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Container } from '@lidofinance/lido-ui';
import styled, { keyframes } from 'styled-components';

import { DOT_SIZE, HEADER_PADDING_Y, NAV_MOBILE_MEDIA } from 'styles/constants';

export const HeaderStyle = styled((props) => <Container {...props} />)`
position: relative;
padding-top: ${HEADER_PADDING_Y}px;
padding-bottom: ${HEADER_PADDING_Y}px;
padding-top: var(--header-padding-y);
padding-bottom: var(--header-padding-y);
display: flex;
align-items: center;
`;
Expand All @@ -33,8 +31,8 @@ const glimmer = keyframes`
`;

export const DotStyle = styled.p`
height: ${DOT_SIZE}px;
width: ${DOT_SIZE}px;
height: var(--dot-size);
width: var(--dot-size);
background-color: lightgreen;
border-radius: 50%;
animation: ${glimmer} 2s ease-in-out infinite;
Expand All @@ -49,7 +47,7 @@ export const IPFSInfoBoxOnlyDesktopWrapper = styled.div`
width: 255px;
z-index: 3;
${NAV_MOBILE_MEDIA} {
@media screen and (max-width: var(--nav-mobile-max-width)) {
display: none;
}
`;
4 changes: 1 addition & 3 deletions shared/components/layout/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { H1 } from '@lidofinance/lido-ui';
import styled from 'styled-components';

import { NAV_MOBILE_MEDIA } from 'styles/constants';

export const LayoutTitleStyle = styled((props) => <H1 {...props} />)`
font-weight: 800;
font-size: ${({ theme }) => theme.fontSizesMap.xl}px;
Expand Down Expand Up @@ -31,7 +29,7 @@ export const LayoutSubTitleStyle = styled.h4`
export const IPFSInfoBoxOnlyMobileAndPortableWrapper = styled.div`
display: none;
${NAV_MOBILE_MEDIA} {
@media screen and (max-width: var(--nav-mobile-max-width)) {
display: block;
margin-top: -6px;
margin-bottom: 40px;
Expand Down
16 changes: 0 additions & 16 deletions styles/constants.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
export const NAV_MOBILE_HEIGHT = 60;
export const NAV_MOBILE_MAX_WIDTH = 880;
export const NAV_MOBILE_MEDIA = `@media screen and (max-width: ${NAV_MOBILE_MAX_WIDTH}px)`;

export const NAV_DESKTOP_GUTTER_X = 46;

export const HEADER_PADDING_Y = 18;

export const DOT_SIZE = 6;

export const FOOTER_MAX_WIDTH = 1424;

export const FOOTER_DESKTOP_PADDING_X = 32;
export const FOOTER_DESKTOP_PADDING_Y = 24;

export const FOOTER_MOBILE_PADDING_X = 20;
export const FOOTER_MOBILE_PADDING_Y = 18;
export const FOOTER_MOBILE_MARGIN_BOTTOM = 60;
18 changes: 18 additions & 0 deletions styles/global.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import { createGlobalStyle } from 'styled-components';

import { NAV_MOBILE_HEIGHT, NAV_MOBILE_MAX_WIDTH } from './constants';

const GlobalStyle = createGlobalStyle`
:root {
--nav-mobile-height: ${NAV_MOBILE_HEIGHT}px;
--nav-mobile-max-width: ${NAV_MOBILE_MAX_WIDTH}px;
--nav-desktop-gutter-x: 46px;
--header-padding-y: 18px;
--dot-size: 6px;
--footer-max-width: 1424px;
--footer-desktop-padding-x: 32px;
--footer-desktop-padding-y: 24px;
--footer-mobile-padding-x: 20px;
--footer-mobile-padding-y: 18px;
--footer-mobile-margin-bottom: 60px;
}
* {
margin: 0;
padding: 0;
Expand Down

0 comments on commit daadcf4

Please sign in to comment.