Skip to content

Commit

Permalink
Feat/#17 고용인/피고용인 페이지 구현 (#18)
Browse files Browse the repository at this point in the history
* rename: rename AppProviders

* feat: add breakpoints and responsiveStyles method

* feat: add Layout component

* style: add responsive styles for tablet and mobile to SignIn page

* feat: add SignUp page's path

* feat: add Icon component

* feat: add borderColor prop to Card component

* feat: add bold prop to Typo component

* feat: add bounce global animation style

* feat: add useToggle hooks

* fix: add borderRadius css property

* feat: add onClose prop to Modal

* feat: add SignUp page

* rename: rename directory footer to Footer
  • Loading branch information
kang-kibong authored Oct 4, 2024
1 parent 6d8abcf commit 9a05c5c
Show file tree
Hide file tree
Showing 45 changed files with 554 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type { Preview } from '@storybook/react';
import AppProviders from '../src/components/providers';
import AppProviders from '../src/components/providers/index.provider';

const preview: Preview = {
parameters: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint --cache 'src/**/*.{ts,tsx}'",
"tsc": "tsc --noEmit",
"tsc": "tsc --noEmit --project ./tsconfig.json",
"format": "prettier --write --cache 'src/**/*.{ts,tsx}'",
"lint-staged": "lint-staged",
"preview": "vite preview",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AppProviders from '@components/providers';
import AppProviders from '@components/providers/index.provider';
import { Outlet } from 'react-router-dom';

function App() {
Expand Down
13 changes: 13 additions & 0 deletions src/assets/icons/role/employer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/icons/role/worker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
9 changes: 9 additions & 0 deletions src/assets/styles/animations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { css } from '@emotion/react';

export const bounceAnimation = css`
transition: all 0.15s ease-in-out;
&:hover {
transform: translate(-4px, -4px);
}
`;
2 changes: 2 additions & 0 deletions src/assets/styles/emotion.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// styles/emotion.d.ts
import '@emotion/react';
import { palettes } from './global/palettes';
import { mediaQueries } from './global/breakpoints';

declare module '@emotion/react' {
export interface Theme {
mediaQueries: typeof mediaQueries;
palettes: typeof palettes;
}
}
9 changes: 9 additions & 0 deletions src/assets/styles/global/breakpoints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const breakpoints = {
tablet: '768px',
mobile: '480px',
} as const;

export const mediaQueries = {
tablet: `@media (max-width: ${breakpoints.tablet})`,
mobile: `@media (max-width: ${breakpoints.mobile})`,
};
2 changes: 2 additions & 0 deletions src/assets/styles/global/palettes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export const palettes = {
white: '#fff',
black: '#000',
blue: '#0A65CC',
gray: '#5E6670',
backgroundGray: '#F1F2F4',
borderGray: '#e4e5e8',
} as const;

Expand Down
27 changes: 27 additions & 0 deletions src/assets/styles/helpers/responsive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import theme from '../theme';

export const responsiveSectionPadding = {
default: {
padding: '100px 0',
},
tablet: {
padding: '80px 0',
},
mobile: {
padding: '60px 0',
},
};

export const responsiveStyle = (styles: {
default?: { [key: string]: string };
tablet?: { [key: string]: string };
mobile?: { [key: string]: string };
}) => ({
...styles.default,
[theme.mediaQueries.tablet]: {
...styles.tablet,
},
[theme.mediaQueries.mobile]: {
...styles.mobile,
},
});

This file was deleted.

2 changes: 2 additions & 0 deletions src/assets/styles/theme.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Theme } from '@emotion/react';
import { palettes } from './global/palettes';
import { mediaQueries } from './global/breakpoints';

const theme: Theme = {
mediaQueries,
palettes,
};

Expand Down
1 change: 1 addition & 0 deletions src/components/common/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const Wrapper = styled.button(
fontSize: '16px',
fontWeight: 'bold',
border: 'none',
borderRadius: '4px',
justifyContent: 'center',
alignItems: 'center',
cursor: 'pointer',
Expand Down
10 changes: 6 additions & 4 deletions src/components/common/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import styled from '@emotion/styled';
import { PalettesTypes } from '@assets/styles/global/palettes';
import { HTMLAttributes, ReactNode } from 'react';

interface Props extends HTMLAttributes<HTMLDivElement> {
borderColor?: PalettesTypes;
borderRadius?: string;
children: ReactNode;
}

export default function Card({ borderRadius = '12px', children, ...rest }: Props) {
export default function Card({ borderColor, borderRadius = '12px', children, ...rest }: Props) {
return (
<CardContainer borderRadius={borderRadius} {...rest}>
<CardContainer borderColor={borderColor} borderRadius={borderRadius} {...rest}>
{children}
</CardContainer>
);
}

const CardContainer = styled.div<{ borderRadius: string }>`
const CardContainer = styled.div<Omit<Props, 'children'>>`
display: inline-block;
border: 1px solid ${({ theme }) => theme.palettes.white};
box-shadow: 0px 12px 32px 0px rgba(24, 25, 28, 0.08);
border: 1px solid ${({ borderColor }) => borderColor};
border-radius: ${({ borderRadius }) => borderRadius};
`;
9 changes: 9 additions & 0 deletions src/components/common/Icon/Role.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Employer from '@assets/icons/role/employer.svg?react';
import Worker from '@assets/icons/role/worker.svg?react';

const Role = {
Employer,
Worker,
};

export default Role;
15 changes: 15 additions & 0 deletions src/components/common/Icon/Social.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Google from '@assets/icons/social/google.svg?react';
import Facebook from '@assets/icons/social/facebook.svg?react';
import Instagram from '@assets/icons/social/instagram.svg?react';
import Twitter from '@assets/icons/social/twitter.svg?react';
import Youtube from '@assets/icons/social/youtube.svg?react';

const Social = {
Google,
Facebook,
Instagram,
Twitter,
Youtube,
};

export default Social;
9 changes: 9 additions & 0 deletions src/components/common/Icon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Role from './Role';
import Social from './Social';

const Icon = {
Role,
Social,
};

export default Icon;
33 changes: 24 additions & 9 deletions src/components/common/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,41 @@ export type Props = {
textChildren: ReactNode;
buttonChildren: ReactNode;
borderRadius?: string;
onClose: () => void;
} & React.HTMLAttributes<HTMLDivElement>;

const Modal = ({ textChildren, buttonChildren, borderRadius = '12px', ...props }: Props) => {
const Modal = ({ textChildren, buttonChildren, borderRadius = '12px', onClose, ...props }: Props) => {
return (
<Card borderRadius={borderRadius} {...props}>
<Wrapper>
<TextWrapper>{textChildren}</TextWrapper>
<ButtonWrapper>{buttonChildren}</ButtonWrapper>
</Wrapper>
</Card>
<Overlay onClick={onClose}>
<Card borderRadius={borderRadius} {...props} onClick={(e) => e.stopPropagation()}>
<Wrapper>
<TextWrapper>{textChildren}</TextWrapper>
<ButtonWrapper>{buttonChildren}</ButtonWrapper>
</Wrapper>
</Card>
</Overlay>
);
};

const Card = styled.div<{ borderRadius: string }>`
const Overlay = styled.div`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
`;

const Card = styled.div<{ borderRadius: string }>`
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
border-radius: ${({ borderRadius }) => borderRadius};
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
`;

Expand All @@ -37,7 +52,7 @@ const Wrapper = styled.div`
align-items: center;
`;

const TextWrapper = styled.p`
const TextWrapper = styled.div`
width: 100%;
font-size: 16px;
font-weight: bold;
Expand Down
6 changes: 4 additions & 2 deletions src/components/common/Typo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ type Props = {
size?: string;
color?: PalettesTypes;
style?: React.CSSProperties;
bold?: boolean;
children: React.ReactNode;
};

export default function Typo({ element = 'div', size, color, children, style }: Props) {
export default function Typo({ element = 'div', size, color, children, style, bold }: Props) {
const theme = useTheme();
const Component = element;
const textColor = color ? theme.palettes[color] : 'black';
const fontWeight = bold ? '700' : '400';

return <Component style={{ fontSize: size, color: textColor, ...style }}>{children}</Component>;
return <Component css={{ fontSize: size, color: textColor, fontWeight, ...style }}>{children}</Component>;
}
1 change: 1 addition & 0 deletions src/components/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { default as InnerContainer } from './InnerContainer';
export { default as Input } from './Input';
export { default as Modal } from './Modal';
export { default as Typo } from './Typo';
export { default as Icon } from './Icon';
File renamed without changes.
34 changes: 34 additions & 0 deletions src/features/auth/components/RoleModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Modal, Typo, Flex, Button } from '@components/common';
import { ReactNode } from 'react';

type Props = {
content: ReactNode;
onClose: () => void;
};

export default function RoleModal({ content, onClose }: Props) {
return (
<Modal
textChildren={
<div css={{ textAlign: 'center' }}>
<Typo element="strong" size="18px" bold>
정보를 입력해주세요. <br />
<br />
{content}
<br />
<br />
<span css={{ fontWeight: '400' }}>* 추후 마이페이지에서 수정 할 수 있습니다.</span>
</Typo>
<br />
</div>
}
buttonChildren={
<Flex gap={{ x: '16px' }}>
<Button theme="default">등록할게요</Button>
<Button theme="outlined">괜찮아요</Button>
</Flex>
}
onClose={onClose}
/>
);
}
16 changes: 16 additions & 0 deletions src/features/auth/components/RoleSelection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Flex } from '@components/common';
import RoleSelector from './RoleSelector';
import { ReactNode } from 'react';

type Props = {
onRoleSelect: (modalContent: ReactNode) => void;
};

export default function RoleSelection({ onRoleSelect }: Props) {
return (
<Flex justifyContent="center" alignItems="center" gap={{ x: '30px' }}>
<RoleSelector role="employer" onClick={onRoleSelect} />
<RoleSelector role="worker" onClick={onRoleSelect} />
</Flex>
);
}
26 changes: 26 additions & 0 deletions src/features/auth/components/RoleSelector/index.config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Icon } from '@components/common';

export const roleConfig = {
employer: {
icon: <Icon.Role.Employer />,
text: '사업주 가입',
modalContent: (
<>
이력서에 대한 정보가 필요해요.
<br />
이력서 정보를 등록하러 가실까요?
</>
),
},
worker: {
icon: <Icon.Role.Worker />,
text: '근로자 가입',
modalContent: (
<>
사업장에 대한 정보가 필요해요.
<br />
사업주 정보를 등록하러 가실까요?
</>
),
},
};
27 changes: 27 additions & 0 deletions src/features/auth/components/RoleSelector/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Card, Flex, Typo } from '@components/common';
import { roleConfig } from './index.config';
import { bounceAnimation } from '@assets/styles/animations';
import { ReactNode } from 'react';

type Props = {
role: 'employer' | 'worker';
onClick: (modalContent: ReactNode) => void;
};

export default function RoleSelector({ role, onClick }: Props) {
return (
<Card
borderColor="blue"
borderRadius="12px"
css={[bounceAnimation, { padding: '60px 120px', cursor: 'pointer' }]}
onClick={() => onClick(roleConfig[role].modalContent)}
>
<Flex direction="column" alignItems="center">
<div css={{ marginBottom: '24px' }}>{roleConfig[role].icon}</div>
<Typo element="h2" color="blue" size="18px" bold>
{roleConfig[role].text}
</Typo>
</Flex>
</Card>
);
}
Empty file removed src/features/index.ts
Empty file.
Loading

0 comments on commit 9a05c5c

Please sign in to comment.