Skip to content

Commit

Permalink
Merge pull request #678 from bamdadfr/next/bamdad
Browse files Browse the repository at this point in the history
  • Loading branch information
bamdadfr authored Jul 12, 2024
2 parents 649d946 + ef0c38d commit 7a4cee7
Show file tree
Hide file tree
Showing 32 changed files with 313 additions and 266 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
"@testing-library/react": "^16.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/gl-react": "^3.15.8",
"@types/gl-react-dom": "^3.15.8",
"@types/gl-react-image": "^3.2.4",
"@types/grecaptcha": "^3.0.9",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.10",
Expand Down
32 changes: 32 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 46 additions & 3 deletions src/app/shared.styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {mediaQueries} from 'src/app/styles/breakpoints';
import {widths} from 'src/app/styles/widths';
import styled, {css} from 'styled-components';

export const centerFlex = css`
Expand All @@ -11,9 +12,9 @@ export const CenteredDiv = styled.div`
${centerFlex};
`;

const p = 14;
export const addMargins = css`
margin: ${p - 4}px ${p}px;
export const p = 14;
export const addPaddings = css`
padding: ${p - 4}px ${p}px;
`;

export const addFontSizeSmall = css`
Expand Down Expand Up @@ -58,6 +59,13 @@ export const addColorsDefault = css`
export const addVerticalScroll = css`
overflow-x: hidden;
overflow-y: auto;
`;

export const addPaddingTop = css`
padding-top: ${p * 4}px;
`;

export const addPaddingRight = css`
padding-right: ${p}px;
`;

Expand All @@ -71,3 +79,38 @@ export const addHoverLink = css`
}
}
`;

export const addGap = css`
gap: ${p}px;
`;

export const addGapDouble = css`
gap: ${p * 2}px;
`;

export const maximize = css`
width: 100%;
height: 100%;
`;

export const addSquareWidths = css`
${mediaQueries.below.tablet} {
width: calc(${widths.mobile} + 3em);
}
${mediaQueries.above.tablet} {
width: calc(${widths.tablet} + 2em);
}
${mediaQueries.above.desktop} {
width: calc(${widths.desktop} + 2em);
}
${mediaQueries.above.widescreen} {
width: calc(${widths.widescreen} + 2em);
}
${mediaQueries.above.fullhd} {
width: calc(${widths.fullhd} + 2em);
}
`;
7 changes: 7 additions & 0 deletions src/app/styles/global.js → src/app/styles/global.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import '@fontsource/noto-sans';

import {addColorsDefault, addFontSizes} from 'src/app/shared.styles';
import {createGlobalStyle} from 'styled-components';

// noinspection CssUnusedSymbol
export const Global = createGlobalStyle`
html {
font-family: 'Noto Sans', sans-serif;
${addColorsDefault};
${addFontSizes};
}
body {
overflow: hidden
}
// scrollbars
Expand Down
10 changes: 5 additions & 5 deletions src/app/styles/widths.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const widths = {
mobile: '95vw',
tablet: '80vw',
desktop: '60vw',
widescreen: '45vw',
fullhd: '40vw',
mobile: '95%',
tablet: '80%',
desktop: '60%',
widescreen: '45%',
fullhd: '40%',
};
6 changes: 3 additions & 3 deletions src/components/form/form.component.styles.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {addMargins, centerFlex} from 'src/app/shared.styles';
import {addGapDouble, centerFlex} from 'src/app/shared.styles';
import styled, {css} from 'styled-components';

export const Form = styled.form`
${centerFlex};
${addMargins};
height: 100%;
flex-direction: column;
gap: 14px;
${addGapDouble};
`;

const formElement = css`
Expand Down
20 changes: 15 additions & 5 deletions src/components/header/header.component.styles.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import {Icon} from '@iconify/react';
import {addHoverLink, addMargins, centerFlex} from 'src/app/shared.styles';
import {
addColorsDefault,
addHoverLink,
addPaddingRight,
addPaddings,
centerFlex,
p,
} from 'src/app/shared.styles';
import styled from 'styled-components';

const p = 14;

export const Container = styled.div`
${centerFlex};
${addMargins};
${addPaddings};
width: calc(100% - ${p}px);
position: fixed;
z-index: 100;
${addColorsDefault};
${addPaddingRight};
`;

const Side = styled.div`
Expand All @@ -23,7 +33,7 @@ export const Left = styled(Side)`
`;

export const Right = styled(Side)`
right: ${p}px;
right: ${p + 4}px;
`;

export const Podium = styled(Icon)`
Expand Down
2 changes: 1 addition & 1 deletion src/components/loading/components/dots/dots.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import {useDotsComponent} from './hooks/use-dots-component';
export function DotsComponent(): ReactElement {
const {dots} = useDotsComponent();

return <div>{dots}</div>;
return <>{dots}</>;
}
40 changes: 13 additions & 27 deletions src/components/loading/loading.component.styles.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,31 @@
import styled from 'styled-components';
import {p} from 'src/app/shared.styles';
import styled, {css} from 'styled-components';

export const Container = styled.div`
display: grid;
display: flex;
justify-content: center;
align-items: center;
grid-template-columns: 1fr 1fr;
grid-gap: 1em;
height: 100%;
`;

transform: translateX(0.5em);
const width = css`
width: 4em;
`;

export const ImageContainer = styled.div`
display: flex;
justify-self: flex-end;
align-items: flex-start;
position: relative;
width: 4em;
${width};
height: 10em;
transform: translateX(-1.5em);
transform: translate3d(-${p}px, -${p * 6}px, 0);
`;

export const TextContainer = styled.div`
export const Text = styled.span`
display: flex;
justify-content: flex-end;
align-items: flex-start;
flex-direction: column;
height: 100%;
width: 100%;
justify-content: flex-start;
align-items: center;
text-align: left;
> h2 {
height: 3em;
}
> div {
height: 40px;
font-size: 0.8em;
}
${width};
`;
13 changes: 6 additions & 7 deletions src/components/loading/loading.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from 'next/legacy/image';
import React, {ReactElement} from 'react';

import {DotsComponent} from './components/dots/dots.component';
import {Container, ImageContainer, TextContainer} from './loading.component.styles';
import {Container, ImageContainer, Text} from './loading.component.styles';

/**
* Component for the loading screen
Expand All @@ -18,12 +18,11 @@ export function LoadingComponent(): ReactElement {
objectFit="contain"
/>
</ImageContainer>
<TextContainer>
<h2>
loading
<DotsComponent />
</h2>
</TextContainer>

<Text>
loading
<DotsComponent />
</Text>
</Container>
);
}
12 changes: 9 additions & 3 deletions src/components/screw-texture/screw-texture.component.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Surface} from 'gl-react-dom/lib';
import GLImage from 'gl-react-image';
import React, {ReactElement} from 'react';
import {withTimeLoop} from 'src/app/components/with-time-loop/with-time-loop';

import {withTimeLoop} from '../../app/components/with-time-loop/with-time-loop';
import {ScrewTextureNode} from './screw-texture.node';

const AnimatedScrewTextureNode = withTimeLoop(ScrewTextureNode);
Expand All @@ -22,9 +22,15 @@ export function ScrewTextureComponent({
width,
}: ScrewTextureComponentProps): ReactElement {
return (
<Surface width={width} height={width}>
<Surface
width={width}
height={width}
>
<AnimatedScrewTextureNode dryWet={dryWet}>
<GLImage source={image} resizeMode="cover" />
<GLImage
source={image}
resizeMode="cover"
/>
</AnimatedScrewTextureNode>
</Surface>
);
Expand Down
12 changes: 3 additions & 9 deletions src/components/screw-texture/screw-texture.node.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Node} from 'gl-react';
import React, {ReactElement} from 'react';
import {mapRange} from 'src/utils/map-range/map-range';

import {mapRange} from '../../utils/map-range/map-range';
import {shaders} from './screw-texture.shaders';

interface ScrewTextureNodeProps {
Expand All @@ -17,14 +17,8 @@ export function ScrewTextureNode({
}: ScrewTextureNodeProps): ReactElement {
const time = propTime / 1000;

const dryWet = 0.005 + mapRange(
parseFloat(propDryWet),
0.5,
1.5,
1.6,
-1.6,
true,
);
const dryWet =
0.005 + mapRange(parseFloat(propDryWet), 0.5, 1.5, 1.6, -1.6, true);

return (
<Node
Expand Down
2 changes: 2 additions & 0 deletions src/components/slider/slider.component.styles.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {addSquareWidths} from 'src/app/shared.styles';
import {type SliderComponentProps} from 'src/components/slider/slider.component';
import styled, {css} from 'styled-components';

Expand Down Expand Up @@ -58,6 +59,7 @@ export const Input = styled.input.attrs((props) => ({
margin: 0;
padding: 0;
${addSquareWidths};
width: ${config.trackW};
height: ${config.thumbD};
background: transparent;
Expand Down
5 changes: 4 additions & 1 deletion src/components/table/table.component.styles.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {addVerticalScroll} from 'src/app/shared.styles';
import {addGap, addVerticalScroll} from 'src/app/shared.styles';
import styled from 'styled-components';

export const Container = styled.div`
${addVerticalScroll};
display: flex;
flex-direction: column;
${addGap};
`;

export const Item = styled.div`
Expand Down
Loading

0 comments on commit 7a4cee7

Please sign in to comment.