Skip to content

Commit

Permalink
fix: fix templates styles to match snapshot expectations (tailwind is…
Browse files Browse the repository at this point in the history
… not yet fixed)
  • Loading branch information
swiiny committed Jan 9, 2025
1 parent 7f2d740 commit 2fa0f0d
Show file tree
Hide file tree
Showing 34 changed files with 103 additions and 50 deletions.
2 changes: 2 additions & 0 deletions packages/base/components/default/Button/Button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
border: none;
background-color: transparent;

padding: 0;

cursor: pointer;

font-size: calc(1.5rem * 0.6);
Expand Down
12 changes: 6 additions & 6 deletions packages/base/components/default/Text/Text.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
}

@include unify-parent('h1') {
@include unify-parent('.h1') {
&.small {
font-size: calc(0.75 * 3rem * 0.7);

Expand Down Expand Up @@ -71,7 +71,7 @@
}
}

@include unify-parent('h2') {
@include unify-parent('.h2') {
&.small {
font-size: calc(0.75 * 2.5rem * 0.7);

Expand Down Expand Up @@ -115,7 +115,7 @@
}
}

@include unify-parent('h3') {
@include unify-parent('.h3') {
&.small {
font-size: calc(0.75 * 2rem * 0.7);

Expand Down Expand Up @@ -158,7 +158,7 @@
}
}
}
@include unify-parent('h4') {
@include unify-parent('.h4') {
&.small {
font-size: calc(0.75 * 1.5rem * 0.7);

Expand Down Expand Up @@ -201,7 +201,7 @@
}
}
}
@include unify-parent('h5') {
@include unify-parent('.h5') {
&.small {
font-size: calc(0.75 * 1.25rem * 0.7);
@include md() {
Expand Down Expand Up @@ -243,7 +243,7 @@
}
}
}
@include unify-parents(('h6', 'p')) {
@include unify-parents(('.h6', 'p')) {
&.small {
font-size: calc(0.75 * 1rem * 0.7);

Expand Down
11 changes: 6 additions & 5 deletions packages/base/components/default/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC } from 'react';
import { IText } from './Text.type';
import styles from './Text.module.scss';
import { ETextType } from './Text.enum';
import { ESize } from '@theme/theme.enum';
import classNames from 'classnames';
import { FC } from 'react';
import { ETextType } from './Text.enum';
import styles from './Text.module.scss';
import { IText } from './Text.type';

const Text: FC<IText> = ({
children,
Expand All @@ -25,7 +25,8 @@ const Text: FC<IText> = ({
[styles[`align`]]: !!align,
[styles[`${align}`]]: !!align,
[styles[`${size}`]]: !!size,
[styles[`${color}`]]: !!color
[styles[`${color}`]]: !!color,
[styles[`${type}`]]: !!type
})}
{...otherProps}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@include md() {
padding-left: 32px;
padding-right: 32px;
padding-top: 30px;
padding-top: 32px;
}

@include lg() {
Expand Down
8 changes: 5 additions & 3 deletions packages/mui/components/default/Button/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const sharedStyle = (p: ISharedButtonProps) => {
border: none;
background-color: transparent;
padding: 0;
cursor: pointer;
font-size: calc(1.5rem * 0.6);
Expand All @@ -33,7 +35,7 @@ const sharedStyle = (p: ISharedButtonProps) => {
background: ${p.color};
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
`
`
: `color: ${p.color || p.theme.colors.white};`}
&:hover {
Expand Down Expand Up @@ -103,7 +105,7 @@ export const StyledIconsContainer = styled.div<{ isActive: boolean }>`
opacity: 1;
transform: translateX(0) rotateX(0);
}
`
`
: css`
&:nth-child(1) {
opacity: 1;
Expand All @@ -113,6 +115,6 @@ export const StyledIconsContainer = styled.div<{ isActive: boolean }>`
opacity: 0;
transform: translateX(50%) rotateX(-90deg);
}
`}
`}
}
`;
6 changes: 5 additions & 1 deletion packages/mui/components/default/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ const Button: FC<IButton> = ({
paddingY={noPaddingResponsive ? '12px' : { xs: '6px', sm: '9px', md: '12px' }}
paddingX={noPaddingResponsive ? '36px' : { xs: '18px', sm: '27px', md: '36px' }}
display='flex'
sx={{ justifyContent: 'center', alignItems: 'center' }}
{...gradientContainerProps}
sx={
gradientContainerProps?.sx
? { justifyContent: 'center', alignItems: 'center', ...gradientContainerProps?.sx }
: { justifyContent: 'center', alignItems: 'center' }
}
>
{children}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { css } from 'styled-components';
import { Box } from '@mui/system';
import styled, { css } from 'styled-components';

export const StyledGradientContainer = styled(Box)`
${(p) => css`
Expand All @@ -8,6 +8,6 @@ export const StyledGradientContainer = styled(Box)`
border-radius: 13px;
background: ${p.theme.colors.darkGradient};
border: 1px solid ${p.theme.colors.darkGray};
box-shadow: 0px 5px 20px 10px ${p.theme.colors.black + '50'};
box-shadow: 0px 5px 20px 10px ${p.theme.colors.darkGray + '50'};
`}
`;
5 changes: 2 additions & 3 deletions packages/mui/components/default/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ const boxStyles = {
position: 'fixed',
left: '0',
right: '0',
marginY: '16px',
paddingX: '16px'
padding: { xs: '0', md: '32px' }
};

const titleStyles = { display: { xs: 'none', sm: 'flex' }, alignItems: 'center' };
const titleStyles = { display: { xs: 'none', sm: 'flex' }, alignItems: 'flex-start' };

const gradientContainerProps = { sx: { display: { xs: 'none', md: 'flex' } } };

Expand Down
5 changes: 5 additions & 0 deletions packages/mui/components/default/Tagline/Tagline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { useTheme } from 'styled-components';
import { ESize } from 'theme/theme.enum';
import { ITagline } from './Tagline.type';

const textStyles = {
marginTop: '12px'
};

const Tagline: FC<ITagline> = () => {
const theme = useTheme();

Expand Down Expand Up @@ -35,6 +39,7 @@ const Tagline: FC<ITagline> = () => {
color={theme.colors.gray}
weight={EFontWeight.regular}
align={ETextAlign.center}
style={textStyles}
>
No longer waste valuable time building your project structure
</Text>
Expand Down
6 changes: 3 additions & 3 deletions packages/mui/components/default/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { IText } from './Text.type';
import { StyledText } from './Text.styles';
import { FC } from 'react';
import { ETextType } from './Text.enum';
import { StyledText } from './Text.styles';
import { IText } from './Text.type';

const Text: FC<IText> = ({ children, type = ETextType.p, component, size, weight, align, color, ...otherProps }) => {
return (
Expand Down
3 changes: 2 additions & 1 deletion packages/mui/components/default/Text/Text.type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ESize } from 'theme/theme.enum';
import { ReactNode } from 'react';
import { ESize } from 'theme/theme.enum';
import { EFontWeight, ETextAlign, ETextType } from './Text.enum';

interface IText {
Expand All @@ -10,6 +10,7 @@ interface IText {
align?: ETextAlign;
size?: ESize.s | ESize.m | ESize.l;
color?: string;
style?: React.CSSProperties;
}

export type { IText };
2 changes: 1 addition & 1 deletion packages/mui/components/pages/home/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const boxStyles = {
flexDirection: 'column',
justifyContent: 'space-evenly',
paddingX: { xs: '15px', md: '32px', lg: '64px' },
paddingTop: '30px',
paddingTop: '32px',
height: '100dvh'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const sharedStyle = (p: ISharedButtonProps) => {
font-size: calc(1.5rem * 0.6);
padding: 0;
${mq(EMediaQuery.sm, `font-size: calc(1.5rem * 0.7);`)}
${mq(EMediaQuery.md, `font-size: calc(1.5rem * 0.8);`)}
${mq(EMediaQuery.lg, `font-size: calc(1.5rem * 0.9);`)}
Expand All @@ -39,7 +41,7 @@ const sharedStyle = (p: ISharedButtonProps) => {
background: ${p.color};
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
`
`
: `color: ${p.color || p.theme.colors.white};`}
&:hover {
Expand Down Expand Up @@ -122,7 +124,7 @@ export const StyledIconsContainer = styled.div<{ isActive: boolean }>`
opacity: 1;
transform: translateX(0) rotateX(0);
}
`
`
: css`
&:nth-child(1) {
opacity: 1;
Expand All @@ -132,6 +134,6 @@ export const StyledIconsContainer = styled.div<{ isActive: boolean }>`
opacity: 0;
transform: translateX(50%) rotateX(-90deg);
}
`}
`}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export const StyledGradientContainer = styled(Flex)`
border-radius: 13px;
background: ${p.theme.colors.darkGradient};
border: 1px solid ${p.theme.colors.darkGray};
box-shadow: 0px 5px 20px 10px ${p.theme.colors.black + '50'};
box-shadow: 0px 5px 20px 10px ${p.theme.colors.darkGray + '50'};
`}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Button from '@components/default/Button';
import Text from '@components/default/Text';
import { ETextType } from '@components/default/Text/Text.enum';
import Flex from '@components/layout/Flex';
import { EFlex } from '@components/layout/Flex/Flex.enum';
import { FaStar } from 'react-icons/fa';
import { EMediaQuery, ESize } from 'theme/theme.enum';
import WalletButton from '../WalletButton';
Expand All @@ -16,7 +17,7 @@ const Navbar = () => {
Create Nextjs Dapp
</Text>

<Flex>
<Flex vertical={EFlex.center}>
<Button
href={repoUrl}
icon={<FaStar size={28} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ const Tagline: FC<ITagline> = () => {
color={theme.colors.gray}
weight={EFontWeight.regular}
align={ETextAlign.center}
marginTop={ESize.xs}
mdMarginTop={ESize.unset}
marginTop={ESize['3xs']}
>
No longer waste valuable time building your project structure
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const StyledText = styled.p<IText>`
background: ${p.color};
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
`
`
: `color: ${p.color || p.theme.colors.white};`}
${p.weight ? `font-weight: ${p.weight};` : ''}
Expand Down Expand Up @@ -49,7 +49,7 @@ export const StyledText = styled.p<IText>`
fontSize = 1;
break;
case ETextType.span:
// the span herit the font-size from the parent
// the span inherit the font-size from the parent
return '';
default:
fontSize = 1;
Expand Down
12 changes: 11 additions & 1 deletion packages/styled-components/components/default/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { ESize } from '@theme/theme.enum';
import { FC } from 'react';
import { ETextType } from './Text.enum';
import { StyledText } from './Text.styles';
import { IText } from './Text.type';

const Text: FC<IText> = ({ children, type = ETextType.p, component, size, weight, align, color, ...otherProps }) => {
const Text: FC<IText> = ({
children,
type = ETextType.p,
component,
size = ESize.m,
weight,
align,
color,
...otherProps
}) => {
return (
<StyledText
as={component || type}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const styles = stylex.create({
height: {
default: '30px',
[MD]: '45px',
[LG]: '60px'
[LG]: '45px'
}
},
link: {
Expand Down
10 changes: 9 additions & 1 deletion packages/stylex/app/_components/navbar/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const repoUrl = 'https://github.com/swiiny/create-nextjs-dapp';

const SM = '@media (max-width: 899px)';
const MD = '@media (min-width: 900px)';
const MAX_MD = '@media (max-width: 900px)';
const MD_TO_XL = '@media (min-width: 900px) and (max-width: 1536px)';
const XL = '@media (min-width: 1536px)';

const styles = stylex.create({
navbar: {
Expand Down Expand Up @@ -46,7 +49,12 @@ const styles = stylex.create({
}
},
icon: {
color: '#e3b341'
color: '#e3b341',
transform: {
[MAX_MD]: 'scale(0.7)',
[MD_TO_XL]: 'scale(0.8)',
[XL]: 'scale(1)'
}
}
});

Expand Down
Loading

0 comments on commit 2fa0f0d

Please sign in to comment.