From bd1dc9ebb90832fde2c6468101bd4454bdedd48b Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 01:12:57 +0900
Subject: [PATCH 001/163] feat: css-in-js woowahan components
---
.../components/create-global-style.tsx | 33 +++++
.../components/theme-provider.tsx | 14 ++
.../components/woowahan-component.tsx | 59 +++++++++
.../woowahan-components/configs/tag-names.ts | 120 ++++++++++++++++++
.../woowahan-components/hooks/use-theme.ts | 8 ++
client/src/lib/woowahan-components/index.ts | 17 +++
.../woowahan-components/utils/generate-id.ts | 9 ++
.../woowahan-components/utils/parse-string.ts | 27 ++++
package.json | 7 +
yarn.lock | 18 +++
10 files changed, 312 insertions(+)
create mode 100644 client/src/lib/woowahan-components/components/create-global-style.tsx
create mode 100644 client/src/lib/woowahan-components/components/theme-provider.tsx
create mode 100644 client/src/lib/woowahan-components/components/woowahan-component.tsx
create mode 100644 client/src/lib/woowahan-components/configs/tag-names.ts
create mode 100644 client/src/lib/woowahan-components/hooks/use-theme.ts
create mode 100644 client/src/lib/woowahan-components/index.ts
create mode 100644 client/src/lib/woowahan-components/utils/generate-id.ts
create mode 100644 client/src/lib/woowahan-components/utils/parse-string.ts
create mode 100644 package.json
create mode 100644 yarn.lock
diff --git a/client/src/lib/woowahan-components/components/create-global-style.tsx b/client/src/lib/woowahan-components/components/create-global-style.tsx
new file mode 100644
index 0000000..9859c52
--- /dev/null
+++ b/client/src/lib/woowahan-components/components/create-global-style.tsx
@@ -0,0 +1,33 @@
+import React, { FC } from 'react';
+import { compile, serialize, stringify, middleware } from 'stylis';
+
+import parseString from '../utils/parse-string';
+
+const createGlobalStyle = (styleString: TemplateStringsArray, ...exps: string[]): FC => {
+ const FunctionComponent: FC = () => {
+ const parsedString = parseString(styleString, exps, {});
+
+ const preprocessedStyle = serialize(
+ compile(parsedString),
+ middleware([element => (element.parent === null ? '\n' : ''), stringify]),
+ ).trim();
+
+ const styleList = preprocessedStyle.split('\n');
+
+ const styleSheet = document.styleSheets[0];
+
+ styleList.forEach(style => {
+ if (style) {
+ styleSheet.insertRule(style, styleSheet.cssRules.length);
+ }
+ });
+
+ const ReactElement = React.createElement(React.Fragment, null, null);
+
+ return ReactElement;
+ };
+
+ return FunctionComponent;
+};
+
+export default createGlobalStyle;
diff --git a/client/src/lib/woowahan-components/components/theme-provider.tsx b/client/src/lib/woowahan-components/components/theme-provider.tsx
new file mode 100644
index 0000000..e608401
--- /dev/null
+++ b/client/src/lib/woowahan-components/components/theme-provider.tsx
@@ -0,0 +1,14 @@
+import React, { FC, createContext } from 'react';
+
+export interface IThemeContext {
+ [key: string]: string;
+}
+
+export const ThemeContext = createContext({});
+
+const ThemeProvider: FC<{ theme: IThemeContext }> = props => {
+ const { children, theme } = props;
+ return {children};
+};
+
+export default ThemeProvider;
diff --git a/client/src/lib/woowahan-components/components/woowahan-component.tsx b/client/src/lib/woowahan-components/components/woowahan-component.tsx
new file mode 100644
index 0000000..4ff6159
--- /dev/null
+++ b/client/src/lib/woowahan-components/components/woowahan-component.tsx
@@ -0,0 +1,59 @@
+import React, { FC } from 'react';
+import { compile, serialize, stringify, middleware } from 'stylis';
+
+import useTheme from '../hooks/use-theme';
+import generateId from '../utils/generate-id';
+import parseString, { IProps, ExpType } from '../utils/parse-string';
+import { IThemeContext } from './theme-provider';
+
+export type TaggedTemplateType = (styleString: TemplateStringsArray, ...exps: ExpType) => FC;
+
+const woowahanComponent = (tag: string): TaggedTemplateType => {
+ const classMap = new Map();
+
+ return (styleString: TemplateStringsArray, ...exps: ExpType): FC => {
+ const FuntionComponent: FC = props => {
+ const theme = useTheme();
+ const parsedString = parseString(styleString, exps, { theme, ...props });
+
+ let className = '';
+
+ const isAlreadyInserted = classMap.has(parsedString);
+
+ if (isAlreadyInserted) {
+ className = classMap.get(parsedString) as string;
+ } else {
+ className = `wc-${generateId()}`;
+ classMap.set(parsedString, className);
+ }
+
+ const nomralisedStyle = serialize(compile(`.${className} {${parsedString}}`), stringify);
+
+ const preprocessedStyle = serialize(
+ compile(nomralisedStyle),
+ middleware([stringify, element => (element.parent === null ? '\n' : '')]),
+ ).trim();
+
+ const styleList = preprocessedStyle.split('\n');
+
+ const styleSheet = document.styleSheets[0];
+
+ if (!isAlreadyInserted) {
+ styleList.forEach(style => {
+ if (style) {
+ styleSheet.insertRule(style, styleSheet.cssRules.length);
+ }
+ });
+ }
+
+ const { children } = props;
+ const ReactElement = React.createElement(tag, { className, theme, ...props }, children);
+
+ return ReactElement;
+ };
+
+ return FuntionComponent;
+ };
+};
+
+export default woowahanComponent;
diff --git a/client/src/lib/woowahan-components/configs/tag-names.ts b/client/src/lib/woowahan-components/configs/tag-names.ts
new file mode 100644
index 0000000..7f069ef
--- /dev/null
+++ b/client/src/lib/woowahan-components/configs/tag-names.ts
@@ -0,0 +1,120 @@
+const tags = [
+ 'a',
+ 'abbr',
+ 'address',
+ 'article',
+ 'aside',
+ 'audio',
+ 'b',
+ 'base',
+ 'bdi',
+ 'bdo',
+ 'blockquote',
+ 'body',
+ 'br',
+ 'button',
+ 'canvas',
+ 'caption',
+ 'cite',
+ 'code',
+ 'col',
+ 'colgroup',
+ 'data',
+ 'datalist',
+ 'dd',
+ 'del',
+ 'details',
+ 'dfn',
+ 'dialog',
+ 'div',
+ 'dl',
+ 'dt',
+ 'em',
+ 'embed',
+ 'fieldset',
+ 'figcaption',
+ 'figure',
+ 'footer',
+ 'form',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'head',
+ 'header',
+ 'hgroup',
+ 'hr',
+ 'html',
+ 'i',
+ 'iframe',
+ 'img',
+ 'input',
+ 'ins',
+ 'kbd',
+ 'label',
+ 'legend',
+ 'li',
+ 'link',
+ 'main',
+ 'map',
+ 'mark',
+ 'math',
+ 'menu',
+ 'menuitem',
+ 'meta',
+ 'meter',
+ 'nav',
+ 'noscript',
+ 'object',
+ 'ol',
+ 'optgroup',
+ 'option',
+ 'output',
+ 'p',
+ 'param',
+ 'picture',
+ 'pre',
+ 'progress',
+ 'q',
+ 'rb',
+ 'rp',
+ 'rt',
+ 'rtc',
+ 'ruby',
+ 's',
+ 'samp',
+ 'script',
+ 'section',
+ 'select',
+ 'slot',
+ 'small',
+ 'source',
+ 'span',
+ 'strong',
+ 'style',
+ 'sub',
+ 'summary',
+ 'sup',
+ 'svg',
+ 'table',
+ 'tbody',
+ 'td',
+ 'template',
+ 'textarea',
+ 'tfoot',
+ 'th',
+ 'thead',
+ 'time',
+ 'title',
+ 'tr',
+ 'track',
+ 'u',
+ 'ul',
+ 'var',
+ 'video',
+ 'wbr',
+];
+
+export default tags;
diff --git a/client/src/lib/woowahan-components/hooks/use-theme.ts b/client/src/lib/woowahan-components/hooks/use-theme.ts
new file mode 100644
index 0000000..14b3cbb
--- /dev/null
+++ b/client/src/lib/woowahan-components/hooks/use-theme.ts
@@ -0,0 +1,8 @@
+import { useContext } from 'react';
+import { ThemeContext, IThemeContext } from '../components/theme-provider';
+
+const useTheme = (): IThemeContext => {
+ return useContext(ThemeContext);
+};
+
+export default useTheme;
diff --git a/client/src/lib/woowahan-components/index.ts b/client/src/lib/woowahan-components/index.ts
new file mode 100644
index 0000000..22b44dd
--- /dev/null
+++ b/client/src/lib/woowahan-components/index.ts
@@ -0,0 +1,17 @@
+import woowahanComponent, { TaggedTemplateType } from './components/woowahan-component';
+import tags from './configs/tag-names';
+
+export { default as createGlobalStyle } from './components/create-global-style';
+export { default as ThemeProvider } from './components/theme-provider';
+
+export interface IWoowahan {
+ [key: string]: TaggedTemplateType;
+}
+
+const woowahan: IWoowahan = {};
+
+tags.forEach((tag: string) => {
+ woowahan[tag] = woowahanComponent(tag);
+});
+
+export default woowahan;
diff --git a/client/src/lib/woowahan-components/utils/generate-id.ts b/client/src/lib/woowahan-components/utils/generate-id.ts
new file mode 100644
index 0000000..9f9d04a
--- /dev/null
+++ b/client/src/lib/woowahan-components/utils/generate-id.ts
@@ -0,0 +1,9 @@
+import { customAlphabet } from 'nanoid';
+
+const alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+const size = 8;
+const nanoid = customAlphabet(alphabet, size);
+
+const generateId = (): string => nanoid();
+
+export default generateId;
diff --git a/client/src/lib/woowahan-components/utils/parse-string.ts b/client/src/lib/woowahan-components/utils/parse-string.ts
new file mode 100644
index 0000000..37c9a67
--- /dev/null
+++ b/client/src/lib/woowahan-components/utils/parse-string.ts
@@ -0,0 +1,27 @@
+import { IThemeContext } from '../components/theme-provider';
+
+export interface IProps {
+ children?: React.ReactNode;
+ theme?: IThemeContext;
+ [key: string]: unknown;
+}
+
+export type ExpType = (((props: IProps) => string | undefined) | string | number)[];
+
+const parseString = (styleString: TemplateStringsArray, exps: ExpType, props: IProps): string => {
+ return styleString
+ .map((string, i) => {
+ let expResult = '';
+ if (exps[i]) {
+ if (typeof exps[i] === 'function') {
+ expResult = `${(exps[i] as (props: IProps) => string | number)(props)}`;
+ } else if (typeof exps[i] === 'string' || typeof exps[i] === 'number') {
+ expResult = `${exps[i] as string | number}`;
+ }
+ }
+ return `${string}${expResult}`;
+ })
+ .join('');
+};
+
+export default parseString;
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..90f2d78
--- /dev/null
+++ b/package.json
@@ -0,0 +1,7 @@
+{
+ "dependencies": {
+ "@types/stylis": "^4.0.1",
+ "nanoid": "^3.1.25",
+ "stylis": "^4.0.10"
+ }
+}
diff --git a/yarn.lock b/yarn.lock
new file mode 100644
index 0000000..35c9c30
--- /dev/null
+++ b/yarn.lock
@@ -0,0 +1,18 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+"@types/stylis@^4.0.1":
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.0.1.tgz#ed14588039b713fc3183cfa0e95033e86e5e1aa2"
+ integrity sha512-tMMy2pb95ZvBrvrNhZDj6fsU1SpR97BYeoS798IRCzKLqWY0bh0rtg9G6knNtiUD6Pij1PoafHYjVCbspKenOA==
+
+nanoid@^3.1.25:
+ version "3.1.25"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152"
+ integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==
+
+stylis@^4.0.10:
+ version "4.0.10"
+ resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240"
+ integrity sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==
From e50d97cb7b68df277df6e3607f187a655ea0e5af Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 01:16:59 +0900
Subject: [PATCH 002/163] =?UTF-8?q?fix:=20woowahan=20components=20?=
=?UTF-8?q?=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/auth/form.tsx | 40 +++++++--------
client/src/components/auth/logout-modal.tsx | 6 +--
client/src/components/auth/success-modal.tsx | 10 ++--
client/src/components/common/footer.tsx | 38 +++++++-------
client/src/components/common/header.tsx | 12 ++---
client/src/components/common/layout.tsx | 10 ++--
client/src/components/common/logo.tsx | 4 +-
client/src/components/common/modal.tsx | 50 +++++++++----------
client/src/components/common/navbar.tsx | 22 ++++----
client/src/components/form/button.tsx | 24 ++++-----
client/src/components/form/input.tsx | 22 ++++----
client/src/components/smart-menu/index.tsx | 22 ++++----
.../src/components/smart-menu/large-menu.tsx | 24 ++++-----
.../src/components/smart-menu/medium-menu.tsx | 22 ++++----
.../src/components/smart-menu/small-menu.tsx | 18 +++----
client/src/pages/not-found-page.tsx | 10 ++--
client/src/pages/signup-page.tsx | 4 +-
17 files changed, 161 insertions(+), 177 deletions(-)
diff --git a/client/src/components/auth/form.tsx b/client/src/components/auth/form.tsx
index 8fdf8ef..cf81804 100644
--- a/client/src/components/auth/form.tsx
+++ b/client/src/components/auth/form.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import { Link } from 'lib/router';
import { Input, Button } from 'components';
import baedal from 'assets/icons/baedalee.png';
@@ -17,83 +17,83 @@ interface AuthFormProps {
onCheckChange?: (e: React.ChangeEvent) => void;
}
-const Wrapper = styled.div`
+const Wrapper = woowahan.div`
display: flex;
flex-direction: column;
margin-top: 50px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
> * {
width: 100%;
max-width: 380px;
}
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
margin: 15px;
max-width: 380px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
width: 400px;
}
`;
-const Form = styled.form`
+const Form = woowahan.form`
> * {
width: 100%;
}
`;
-const Image = styled.img`
+const Image = woowahan.img`
margin-right: 10px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
width: 26px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
width: 30px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
width: 34px;
}
`;
-const CheckBoxLabel = styled.label`
+const CheckBoxLabel = woowahan.label`
cursor: pointer;
margin-bottom: 20px;
display: flex;
align-items: flex-end;
- font-family: ${props => props.theme.fontHannaAir};
- color: ${props => props.theme.colorSoftBlack};
+ font-family: ${props => props.theme?.fontHannaAir};
+ color: ${props => props.theme?.colorSoftBlack};
input[type='checkbox'] {
margin-right: 10px;
}
`;
-const Error = styled.div`
- color: ${props => props.theme.colorError};
- font-family: ${props => props.theme.fontHannaAir};
+const Error = woowahan.div`
+ color: ${props => props.theme?.colorError};
+ font-family: ${props => props.theme?.fontHannaAir};
font-size: 14px;
height: 30px;
text-indent: 5px;
`;
-const LinkWrapper = styled.div`
+const LinkWrapper = woowahan.div`
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
- font-family: ${props => props.theme.fontEuljiro};
+ font-family: ${props => props.theme?.fontEuljiro};
margin-top: 10px;
a {
font-size: 18px;
- color: ${props => props.theme.colorTextBeige};
+ color: ${props => props.theme?.colorTextBeige};
:hover {
- color: ${props => props.theme.colorLine};
+ color: ${props => props.theme?.colorLine};
}
}
`;
diff --git a/client/src/components/auth/logout-modal.tsx b/client/src/components/auth/logout-modal.tsx
index dc4ff65..9613752 100644
--- a/client/src/components/auth/logout-modal.tsx
+++ b/client/src/components/auth/logout-modal.tsx
@@ -1,10 +1,10 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import { Modal } from 'components';
-const Title = styled.h2`
+const Title = woowahan.h2`
span {
- color: ${props => props.theme.colorPrimary};
+ color: ${props => props.theme?.colorPrimary};
}
`;
diff --git a/client/src/components/auth/success-modal.tsx b/client/src/components/auth/success-modal.tsx
index 06647b9..635f739 100644
--- a/client/src/components/auth/success-modal.tsx
+++ b/client/src/components/auth/success-modal.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import { Modal } from 'components';
import { IUserId } from 'types/auth';
@@ -7,19 +7,19 @@ interface AuthSuccessModalProps {
userId: IUserId;
}
-const Title = styled.h2`
+const Title = woowahan.h2`
span {
- color: ${props => props.theme.colorPrimary};
+ color: ${props => props.theme?.colorPrimary};
}
`;
-const Info = styled.div`
+const Info = woowahan.div`
p {
margin-bottom: 3px;
}
span {
- font-family: ${props => props.theme.fontHanna};
+ font-family: ${props => props.theme?.fontHanna};
font-size: 105%;
vertical-align: middle;
margin-right: 1px;
diff --git a/client/src/components/common/footer.tsx b/client/src/components/common/footer.tsx
index d87e1b9..7cc44ce 100644
--- a/client/src/components/common/footer.tsx
+++ b/client/src/components/common/footer.tsx
@@ -1,49 +1,49 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import { Logo } from 'components';
interface FooterProps {
isMobile: boolean;
}
-const Wrapper = styled.footer`
+const Wrapper = woowahan.footer`
width: 100%;
min-height: 200px;
- background-color: ${props => props.theme.colorFooter};
+ background-color: ${props => props.theme?.colorFooter};
box-sizing: border-box;
display: flex;
padding: 30px 10%;
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
display: flex;
flex-direction: column;
padding: 30px 2%;
}
`;
-const Left = styled.div`
+const Left = woowahan.div`
width: 30%;
display: flex;
justify-content: center;
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
width: 100%;
margin-top: 20px;
}
`;
-const Right = styled.div`
+const Right = woowahan.div`
width: 70%;
display: flex;
flex-direction: column;
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
width: 100%;
margin-top: 20px;
}
`;
-const Links = styled.div`
+const Links = woowahan.div`
margin-top: 5px;
margin-bottom: 20px;
@@ -53,12 +53,12 @@ const Links = styled.div`
}
ul li a {
- color: ${props => props.theme.colorSoftBlack};
- font-weight: ${props => props.theme.weightBold};
+ color: ${props => props.theme?.colorSoftBlack};
+ font-weight: ${props => props.theme?.weightBold};
font-size: 14px;
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
display: flex;
justify-content: center;
@@ -68,30 +68,30 @@ const Links = styled.div`
}
ul li:not(:last-child) {
- border-right: 1px solid ${props => props.theme.colorGreyDark};
+ border-right: 1px solid ${props => props.theme?.colorGreyDark};
}
ul li a {
- color: ${props => props.theme.colorGreyDark};
+ color: ${props => props.theme?.colorGreyDark};
}
}
`;
-const Info = styled.div`
+const Info = woowahan.div`
p {
- color: ${props => props.theme.colorGreyDark};
+ color: ${props => props.theme?.colorGreyDark};
font-size: 12px;
line-height: 18px;
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
text-align: center;
margin-top: 15px;
margin-bottom: 20px;
p {
- color: ${props => props.theme.colorPointBeigeLight};
- font-family: ${props => props.theme.fontEuljiro};
+ color: ${props => props.theme?.colorPointBeigeLight};
+ font-family: ${props => props.theme?.fontEuljiro};
}
}
`;
diff --git a/client/src/components/common/header.tsx b/client/src/components/common/header.tsx
index 0631cb1..f6f1858 100644
--- a/client/src/components/common/header.tsx
+++ b/client/src/components/common/header.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import { Link } from 'lib/router';
import { Logo, Navbar } from 'components';
import BrickBg from 'assets/images/brick.png';
@@ -12,11 +12,11 @@ interface HeaderProps {
onLogout: () => void;
}
-const Wrapper = styled.header`
+const Wrapper = woowahan.header`
width: 100%;
`;
-const Brick = styled.div`
+const Brick = woowahan.div`
width: 100%;
height: 150px;
background-image: url(${BrickBg});
@@ -28,18 +28,18 @@ const Brick = styled.div`
}
`;
-const Tent = styled.div`
+const Tent = woowahan.div`
width: 100%;
height: 80px;
background-image: url(${TentBg});
background-repeat: repeat-x;
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
margin-top: -15px;
}
`;
-const LogoWrapper = styled.div`
+const LogoWrapper = woowahan.div`
display: flex;
justify-content: center;
padding: 25px 0;
diff --git a/client/src/components/common/layout.tsx b/client/src/components/common/layout.tsx
index 5b8a93a..ceafc9e 100644
--- a/client/src/components/common/layout.tsx
+++ b/client/src/components/common/layout.tsx
@@ -1,9 +1,9 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
-const Wrapper = styled.div`
+const Wrapper = woowahan.div`
min-height: 100%;
- background-color: ${props => props.theme.colorBg};
+ background-color: ${props => props.theme?.colorBg};
display: flex;
flex-direction: column;
@@ -14,13 +14,13 @@ const Wrapper = styled.div`
justify-content: center;
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
main {
padding: 0 12px;
}
}
- ${props => props.theme.laptop} {
+ ${props => props.theme?.laptop} {
align-items: center;
main {
padding: 0;
diff --git a/client/src/components/common/logo.tsx b/client/src/components/common/logo.tsx
index 2f7a276..1f62210 100644
--- a/client/src/components/common/logo.tsx
+++ b/client/src/components/common/logo.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import LogoImg from 'assets/images/logo.png';
import LogoTentImg from 'assets/images/logo_tent.png';
@@ -12,7 +12,7 @@ interface LogoProps {
mobile?: boolean;
}
-const Wrapper = styled.div`
+const Wrapper = woowahan.div`
width: fit-content;
`;
diff --git a/client/src/components/common/modal.tsx b/client/src/components/common/modal.tsx
index 4cca07d..27ca790 100644
--- a/client/src/components/common/modal.tsx
+++ b/client/src/components/common/modal.tsx
@@ -1,5 +1,5 @@
import React, { FC, ReactNode } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import alertImg from 'assets/icons/congrats.gif';
import confirmImg from 'assets/icons/wait.png';
@@ -12,7 +12,7 @@ interface ModalProps {
onConfirm?: () => void;
}
-const ModalBlock = styled.div`
+const ModalBlock = woowahan.div`
position: fixed;
left: 0;
top: 0;
@@ -26,33 +26,33 @@ const ModalBlock = styled.div`
z-index: 10;
`;
-const Inner = styled.div`
+const Inner = woowahan.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
- background-color: ${props => props.theme.colorWhite};
+ background-color: ${props => props.theme?.colorWhite};
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.25);
border-radius: 50px;
height: 500px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
border-radius: 40px;
width: 90%;
max-height: 90%;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
width: 650px;
max-width: 90%;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
width: 650px;
}
`;
-const ModalHeader = styled.div`
+const ModalHeader = woowahan.div`
display: flex;
flex-direction: column;
align-items: center;
@@ -62,52 +62,52 @@ const ModalHeader = styled.div`
width: 200px;
margin-bottom: 20px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
width: 150px;
}
}
div {
- color: ${props => props.theme.colorBlack};
- font-family: ${props => props.theme.fontEuljiro};
+ color: ${props => props.theme?.colorBlack};
+ font-family: ${props => props.theme?.fontEuljiro};
font-size: 36px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
font-size: 24px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
font-size: 32px;
}
}
`;
-const ModalBody = styled.div`
+const ModalBody = woowahan.div`
text-align: center;
margin-bottom: 20px;
div {
- color: ${props => props.theme.colorBlack};
- font-family: ${props => props.theme.fontHannaAir};
+ color: ${props => props.theme?.colorBlack};
+ font-family: ${props => props.theme?.fontHannaAir};
font-size: 20px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
font-size: 16px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
font-size: 18px;
}
}
`;
-const ModalFooter = styled.div`
+const ModalFooter = woowahan.div`
margin-top: 10px;
button {
cursor: pointer;
- color: ${props => props.theme.colorWhite};
- font-family: ${props => props.theme.fontEuljiro};
+ color: ${props => props.theme?.colorWhite};
+ font-family: ${props => props.theme?.fontEuljiro};
font-size: 20px;
width: 80px;
padding: 8px 10px;
@@ -116,18 +116,18 @@ const ModalFooter = styled.div`
:first-child {
margin-right: 16px;
- background-color: ${props => props.theme.colorGreyLight};
+ background-color: ${props => props.theme?.colorGreyLight};
&:hover {
- background-color: ${props => props.theme.colorGreyMid};
+ background-color: ${props => props.theme?.colorGreyMid};
}
}
:last-child {
- background-color: ${props => props.theme.colorPrimaryLight};
+ background-color: ${props => props.theme?.colorPrimaryLight};
&:hover {
- background-color: ${props => props.theme.colorPrimary};
+ background-color: ${props => props.theme?.colorPrimary};
}
}
}
diff --git a/client/src/components/common/navbar.tsx b/client/src/components/common/navbar.tsx
index ec7ea17..69103b1 100644
--- a/client/src/components/common/navbar.tsx
+++ b/client/src/components/common/navbar.tsx
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import { Link } from 'lib/router';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import { Logo } from 'components';
import accountIcon from 'assets/icons/account.png';
@@ -15,13 +15,9 @@ interface NavbarProps {
onLogout: () => void;
}
-interface WrapperProps {
- white: boolean;
-}
-
-const Wrapper = styled.nav`
- background-color: ${props => (props.white ? props.theme.colorWhite : props.theme.colorBg)};
- border-bottom: 1px solid ${props => props.theme.colorLineLight};
+const Wrapper = woowahan.nav`
+ background-color: ${props => (props.white ? props.theme?.colorWhite : props.theme?.colorBg)};
+ border-bottom: 1px solid ${props => props.theme?.colorLineLight};
padding: 10px 10%;
display: flex;
justify-content: flex-end;
@@ -35,18 +31,18 @@ const Wrapper = styled.nav`
.nav-link {
font-size: 12px;
- font-weight: ${props => props.theme.weightMid};
- color: ${props => props.theme.colorGreyDark};
+ font-weight: ${props => props.theme?.weightMid};
+ color: ${props => props.theme?.colorGreyDark};
text-decoration: none;
padding: 0 14px;
}
.nav-link:hover {
- color: ${props => props.theme.colorGreyMid};
+ color: ${props => props.theme?.colorGreyMid};
}
- ${props => props.theme.mobile} {
- background-color: ${props => props.theme.colorWhite};
+ ${props => props.theme?.mobile} {
+ background-color: ${props => props.theme?.colorWhite};
border: none;
box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.2);
justify-content: space-between;
diff --git a/client/src/components/form/button.tsx b/client/src/components/form/button.tsx
index 0e33096..0676b66 100644
--- a/client/src/components/form/button.tsx
+++ b/client/src/components/form/button.tsx
@@ -1,23 +1,19 @@
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
-interface ButtonProps {
- color?: 'basic' | 'dark' | 'github';
-}
-
-const Button = styled.button`
+const Button = woowahan.button`
cursor: pointer;
border: 0;
display: flex;
align-items: center;
justify-content: center;
- color: ${({ theme }) => theme.colorWhite};
- font-family: ${({ theme }) => theme.fontEuljiro};
+ color: ${({ theme }) => theme?.colorWhite};
+ font-family: ${({ theme }) => theme?.fontEuljiro};
opacity: 0.9;
margin-bottom: 10px;
background-color: ${props => {
- if (props.color === 'dark') return props.theme.colorLineDark;
- if (props.color === 'github') return props.theme.colorGithub;
- return props.theme.colorLine;
+ if (props.color === 'dark') return props.theme?.colorLineDark;
+ if (props.color === 'github') return props.theme?.colorGithub;
+ return props.theme?.colorLine;
}};
&:hover {
@@ -25,17 +21,17 @@ const Button = styled.button`
transform: translateY(-2px);
}
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
height: 50px;
font-size: 20px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
height: 56px;
font-size: 22px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
height: 64px;
font-size: 24px;
}
diff --git a/client/src/components/form/input.tsx b/client/src/components/form/input.tsx
index 9bb0d5c..1112a50 100644
--- a/client/src/components/form/input.tsx
+++ b/client/src/components/form/input.tsx
@@ -1,9 +1,9 @@
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
-const Input = styled.input`
+const Input = woowahan.input`
border: 0;
- border-bottom: 2px solid ${props => props.theme.colorGreyMid};
- color: ${props => props.theme.colorSoftBlack};
+ border-bottom: 2px solid ${props => props.theme?.colorGreyMid};
+ color: ${props => props.theme?.colorSoftBlack};
background-color: transparent;
line-height: 1.5;
text-indent: 5px;
@@ -12,28 +12,28 @@ const Input = styled.input`
box-sizing: border-box;
&[type='text'] {
- font-family: ${props => props.theme.fontHannaAir};
+ font-family: ${props => props.theme?.fontHannaAir};
}
&::placeholder {
- color: ${props => props.theme.colorPlaceholder};
- font-family: ${props => props.theme.fontHannaAir};
+ color: ${props => props.theme?.colorPlaceholder};
+ font-family: ${props => props.theme?.fontHannaAir};
}
&:focus {
outline: none;
- border-bottom: 2px solid ${props => props.theme.colorLineDark};
+ border-bottom: 2px solid ${props => props.theme?.colorLineDark};
}
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
font-size: 20px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
font-size: 22px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
font-size: 24px;
}
`;
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index b4ed1e3..e1bf023 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,4 +1,4 @@
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import React, { useState, FC } from 'react';
import useWindowSize from 'hooks/use-window-size';
import { IMenu } from 'types/category';
@@ -12,7 +12,7 @@ interface SmartMenuProps {
menu: IMenu;
}
-const MenuDiv = styled.div`
+const MenuDiv = woowahan.div`
cursor: pointer;
position: fixed;
top: 200px;
@@ -21,27 +21,27 @@ const MenuDiv = styled.div`
writing-mode: vertical-lr;
text-orientation: upright;
padding: 24px 12px;
- background-color: ${({ theme }) => theme.colorBg};
+ background-color: ${({ theme }) => theme?.colorBg};
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
- color: ${({ theme }) => theme.colorBlack};
- border: 3px solid ${({ theme }) => theme.colorLineDark};
+ color: ${({ theme }) => theme?.colorBlack};
+ border: 3px solid ${({ theme }) => theme?.colorLineDark};
`;
-const MenuTitle = styled.div`
+const MenuTitle = woowahan.div`
padding-left: 20px;
- color: ${({ theme }) => theme.colorLineDark};
- font-family: ${({ theme }) => theme.fontHanna};
+ color: ${({ theme }) => theme?.colorLineDark};
+ font-family: ${({ theme }) => theme?.fontHanna};
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
font-size: 18px;
transform: translate(0px, -13px);
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
font-size: 20px;
transform: translate(0px, -15px);
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
font-size: 26px;
transform: translate(0px, -17px);
}
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index 1bc4805..a060e56 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -1,4 +1,4 @@
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import React, { FC } from 'react';
import { IMenu } from 'types/category';
import { SMART_MENU_BLOCK_DELAY } from '../../constants';
@@ -17,34 +17,30 @@ interface LargeMenuProps {
>;
}
-interface LargeItemProps {
- isSelected: boolean;
-}
-
-const LargeItemDiv = styled.ul`
+const LargeItemDiv = woowahan.ul`
writing-mode: horizontal-tb;
text-orientation: sideways;
- background-color: ${({ theme }) => theme.colorBg};
+ background-color: ${({ theme }) => theme?.colorBg};
border-radius: 20px;
padding-left: 32px;
`;
-const LargeItem = styled.li`
- font-family: ${({ theme }) => theme.fontHannaAir};
+const LargeItem = woowahan.li`
+ font-family: ${({ theme }) => theme?.fontHannaAir};
display: flex;
- background-color: ${props => (props.isSelected ? props.theme.colorOffWhite : props.theme.colorBg)};
+ background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
- border: 1px solid ${({ theme }) => theme.colorOffWhite};
+ border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
width: 110px;
font-size: 16px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
width: 150px;
font-size: 18px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
width: 200px;
font-size: 22px;
}
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index c096ff8..3ea2561 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -1,4 +1,4 @@
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import React, { FC } from 'react';
import { IMenu } from 'types/category';
@@ -9,31 +9,27 @@ interface MediumMenuProps {
setMediumId: React.Dispatch>;
}
-interface MediumItemProps {
- isSelected: boolean;
-}
-
-const MediumItemDiv = styled.div`
+const MediumItemDiv = woowahan.div`
display: flex;
`;
-const MediumItem = styled.ul`
- font-family: ${({ theme }) => theme.fontHannaAir};
+const MediumItem = woowahan.ul`
+ font-family: ${({ theme }) => theme?.fontHannaAir};
writing-mode: horizontal-tb;
text-orientation: sideways;
- background-color: ${props => (props.isSelected ? props.theme.colorOffWhite : props.theme.colorBg)};
+ background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
- border: 1px solid ${({ theme }) => theme.colorOffWhite};
+ border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
width: 110px;
font-size: 16px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
width: 150px;
font-size: 18px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
width: 200px;
font-size: 22px;
}
diff --git a/client/src/components/smart-menu/small-menu.tsx b/client/src/components/smart-menu/small-menu.tsx
index 1922146..1ea9810 100644
--- a/client/src/components/smart-menu/small-menu.tsx
+++ b/client/src/components/smart-menu/small-menu.tsx
@@ -1,4 +1,4 @@
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import React, { FC } from 'react';
import { IMenu } from 'types/category';
@@ -8,27 +8,27 @@ interface SmallMenuProps {
selectedMediumId: string;
}
-const SmallItemDiv = styled.div`
+const SmallItemDiv = woowahan.div`
writing-mode: horizontal-tb;
text-orientation: sideways;
`;
-const SmallItem = styled.div`
- font-family: ${({ theme }) => theme.fontHannaAir};
+const SmallItem = woowahan.div`
+ font-family: ${({ theme }) => theme?.fontHannaAir};
font-size: 26px;
- background-color: ${({ theme }) => theme.colorBg};
+ background-color: ${({ theme }) => theme?.colorBg};
- border: 1px solid ${({ theme }) => theme.colorOffWhite};
+ border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
- ${({ theme }) => theme.mobile} {
+ ${({ theme }) => theme?.mobile} {
width: 110px;
font-size: 16px;
}
- ${({ theme }) => theme.tablet} {
+ ${({ theme }) => theme?.tablet} {
width: 150px;
font-size: 18px;
}
- ${({ theme }) => theme.laptop} {
+ ${({ theme }) => theme?.laptop} {
width: 200px;
font-size: 22px;
}
diff --git a/client/src/pages/not-found-page.tsx b/client/src/pages/not-found-page.tsx
index 7ce8a55..20b44da 100644
--- a/client/src/pages/not-found-page.tsx
+++ b/client/src/pages/not-found-page.tsx
@@ -1,10 +1,10 @@
import React, { ReactElement } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-const Text = styled.div`
+const Text = woowahan.div`
flex: 1;
display: flex;
flex-direction: column;
@@ -12,8 +12,8 @@ const Text = styled.div`
margin-top: 50px;
span {
- font-family: ${props => props.theme.fontEuljiro10};
- color: ${props => props.theme.colorTextBeige};
+ font-family: ${props => props.theme?.fontEuljiro10};
+ color: ${props => props.theme?.colorTextBeige};
}
span:nth-child(1) {
@@ -24,7 +24,7 @@ const Text = styled.div`
font-size: 80px;
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
span:nth-child(1) {
font-size: 100px;
}
diff --git a/client/src/pages/signup-page.tsx b/client/src/pages/signup-page.tsx
index 76ec2cb..cc73b8b 100644
--- a/client/src/pages/signup-page.tsx
+++ b/client/src/pages/signup-page.tsx
@@ -1,11 +1,11 @@
import React, { ReactElement } from 'react';
-import styled from 'styled-components';
+import woowahan from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import SignupContainer from 'containers/signup-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-const Div = styled.div`
+const Div = woowahan.div`
display: flex;
flex-direction: column;
align-items: center;
From 2336de2a30c490a9c1eacd767f1423bc800077e3 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 01:17:32 +0900
Subject: [PATCH 003/163] =?UTF-8?q?fix:=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?=
=?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/large-menu.tsx | 2 +-
client/src/components/smart-menu/medium-menu.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index a060e56..ef8464c 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -54,7 +54,7 @@ const LargeMenu: FC = ({ menu, position, selectedLargeId, isLapt
return (
{
+ onMouseMove={(e: React.MouseEvent) => {
if (isLaptop) {
setTimeout(() => {
if (e.clientX < position.x + 10) {
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index 3ea2561..f5a8063 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -45,7 +45,7 @@ const MediumMenu: FC = ({ menu, selectedLargeId, selectedMedium
return (
{
+ onMouseEnter={(e: React.MouseEvent) => {
setMediumId(mediumId);
e.stopPropagation();
}}
From c8167470f8f3b74a0ba00de93cd8ee89fbc07d2b Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 01:22:37 +0900
Subject: [PATCH 004/163] =?UTF-8?q?fix:=20=EB=AA=A8=EB=93=88=20=EC=84=A4?=
=?UTF-8?q?=EC=B9=98=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/package.json | 5 ++++-
client/yarn.lock | 15 +++++++++++++++
package.json | 7 -------
3 files changed, 19 insertions(+), 8 deletions(-)
delete mode 100644 package.json
diff --git a/client/package.json b/client/package.json
index 6c0119a..bb0479d 100644
--- a/client/package.json
+++ b/client/package.json
@@ -23,7 +23,9 @@
"dependencies": {
"@reduxjs/toolkit": "^1.6.1",
"@types/redux-logger": "^3.0.9",
+ "@types/stylis": "^4.0.1",
"axios": "^0.21.1",
+ "nanoid": "^3.1.25",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
@@ -33,7 +35,8 @@
"redux-saga-test-plan": "^4.0.3",
"sanitize-html": "^2.4.0",
"styled-components": "^5.3.0",
- "styled-reset": "^4.3.4"
+ "styled-reset": "^4.3.4",
+ "stylis": "^4.0.10"
},
"devDependencies": {
"@babel/cli": "^7.14.8",
diff --git a/client/yarn.lock b/client/yarn.lock
index 97b35dd..0278893 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -1591,6 +1591,11 @@
"@types/react" "*"
csstype "^3.0.2"
+"@types/stylis@^4.0.1":
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.0.1.tgz#ed14588039b713fc3183cfa0e95033e86e5e1aa2"
+ integrity sha512-tMMy2pb95ZvBrvrNhZDj6fsU1SpR97BYeoS798IRCzKLqWY0bh0rtg9G6knNtiUD6Pij1PoafHYjVCbspKenOA==
+
"@types/testing-library__jest-dom@^5.9.1":
version "5.14.1"
resolved "https://registry.yarnpkg.com/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.1.tgz#014162a5cee6571819d48e999980694e2f657c3c"
@@ -6202,6 +6207,11 @@ nanoid@^3.1.23:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81"
integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==
+nanoid@^3.1.25:
+ version "3.1.25"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152"
+ integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==
+
nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
@@ -8213,6 +8223,11 @@ stylehacks@^5.0.1:
browserslist "^4.16.0"
postcss-selector-parser "^6.0.4"
+stylis@^4.0.10:
+ version "4.0.10"
+ resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240"
+ integrity sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==
+
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
diff --git a/package.json b/package.json
deleted file mode 100644
index 90f2d78..0000000
--- a/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "dependencies": {
- "@types/stylis": "^4.0.1",
- "nanoid": "^3.1.25",
- "stylis": "^4.0.10"
- }
-}
From 2da426d58516ad329a8f65ab18163ec9d26952b4 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 01:31:29 +0900
Subject: [PATCH 005/163] =?UTF-8?q?fix:=20=EA=B8=80=EB=A1=9C=EB=B2=8C=20?=
=?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/styles/theme.tsx | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/client/src/styles/theme.tsx b/client/src/styles/theme.tsx
index d9ca03a..6ab83c9 100644
--- a/client/src/styles/theme.tsx
+++ b/client/src/styles/theme.tsx
@@ -57,18 +57,7 @@ const theme: DefaultTheme = {
weightBold: '700',
};
-const GlobalStyle = createGlobalStyle`
- ${reset}
-
- #root {
- width: 100%;
- height: 100vh;
- }
-
- a {
- text-decoration: none;
- }
-
+const GlobalStyle = createGlobalStyle`
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');
@font-face {
@@ -91,7 +80,16 @@ const GlobalStyle = createGlobalStyle`
src: url(${BMHANNAAir}) format('woff');
}
- font-family: 'Noto Sans KR', sans-serif;
+ ${reset[0]}
+
+ #root {
+ width: 100%;
+ height: 100vh;
+ }
+
+ a {
+ text-decoration: none;
+ }
`;
const Theme: FC = ({ children }) => {
From 3c21d8b7ac3d610cc39ff91f367c27ec268827fe Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 01:31:43 +0900
Subject: [PATCH 006/163] =?UTF-8?q?fix:=20html=20=EC=8A=A4=ED=83=80?=
=?UTF-8?q?=EC=9D=BC=20=EC=8B=9C=ED=8A=B8=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/public/index.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/client/public/index.html b/client/public/index.html
index 9a50bd1..2164608 100644
--- a/client/public/index.html
+++ b/client/public/index.html
@@ -5,6 +5,7 @@
배민문구사
+
From c35d1d6845f2cfbfc201b78874c8fd9fcddd8cbb Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 09:45:46 +0900
Subject: [PATCH 007/163] =?UTF-8?q?fix:=20=EB=A3=A8=ED=8A=B8=20=ED=8F=B4?=
=?UTF-8?q?=EB=8D=94=20yarn.lock=20=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yarn.lock | 18 ------------------
1 file changed, 18 deletions(-)
delete mode 100644 yarn.lock
diff --git a/yarn.lock b/yarn.lock
deleted file mode 100644
index 35c9c30..0000000
--- a/yarn.lock
+++ /dev/null
@@ -1,18 +0,0 @@
-# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
-# yarn lockfile v1
-
-
-"@types/stylis@^4.0.1":
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.0.1.tgz#ed14588039b713fc3183cfa0e95033e86e5e1aa2"
- integrity sha512-tMMy2pb95ZvBrvrNhZDj6fsU1SpR97BYeoS798IRCzKLqWY0bh0rtg9G6knNtiUD6Pij1PoafHYjVCbspKenOA==
-
-nanoid@^3.1.25:
- version "3.1.25"
- resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152"
- integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==
-
-stylis@^4.0.10:
- version "4.0.10"
- resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240"
- integrity sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==
From 89b07c3e3ccb4d7cede9bcc294b6de311e6fe4da Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 09:54:48 +0900
Subject: [PATCH 008/163] =?UTF-8?q?fix:=20=ED=85=8C=EB=A7=88=EC=97=90=20?=
=?UTF-8?q?=EC=9A=B0=EC=95=84=ED=95=9C=20=EC=BB=B4=ED=8F=AC=EB=84=8C?=
=?UTF-8?q?=ED=8A=B8=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/styles/theme.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/client/src/styles/theme.tsx b/client/src/styles/theme.tsx
index 6ab83c9..5d49ed3 100644
--- a/client/src/styles/theme.tsx
+++ b/client/src/styles/theme.tsx
@@ -1,12 +1,12 @@
import React, { FC } from 'react';
-import { ThemeProvider, createGlobalStyle, DefaultTheme } from 'styled-components';
+import { ThemeProvider, createGlobalStyle } from 'lib/woowahan-components';
import reset from 'styled-reset';
import BMEULJIRO from '../assets/fonts/BMEULJIRO.woff';
import BMEULJIRO10years from '../assets/fonts/BMEULJIRO10yearslater.woff';
import BMHANNA from '../assets/fonts/BMHANNA11years.woff';
import BMHANNAAir from '../assets/fonts/BMHANNAAir.woff';
-const theme: DefaultTheme = {
+const theme = {
mobile: '@media all and (max-width: 480px)',
tablet: '@media all and (min-width:480px) and (max-width:1200px)',
laptop: '@media all and (min-width: 1200px)',
@@ -80,7 +80,7 @@ const GlobalStyle = createGlobalStyle`
src: url(${BMHANNAAir}) format('woff');
}
- ${reset[0]}
+ ${reset[0] as string}
#root {
width: 100%;
From b65dfe2729ddb4f53e7b182ae74110214524d92a Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 10:01:14 +0900
Subject: [PATCH 009/163] =?UTF-8?q?fix:=20style=20=EC=98=A4=EB=A5=98=20?=
=?UTF-8?q?=ED=95=B4=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/common/modal.tsx | 6 +--
client/src/components/common/navbar.tsx | 2 +-
client/src/components/smart-menu/index.tsx | 2 +-
.../src/components/smart-menu/large-menu.tsx | 2 +-
.../src/components/smart-menu/medium-menu.tsx | 2 +-
.../src/components/smart-menu/small-menu.tsx | 2 +-
client/src/styles/styled.d.ts | 54 -------------------
7 files changed, 8 insertions(+), 62 deletions(-)
delete mode 100644 client/src/styles/styled.d.ts
diff --git a/client/src/components/common/modal.tsx b/client/src/components/common/modal.tsx
index 27ca790..7a0da06 100644
--- a/client/src/components/common/modal.tsx
+++ b/client/src/components/common/modal.tsx
@@ -114,7 +114,7 @@ const ModalFooter = woowahan.div`
border: none;
border-radius: 10px;
- :first-child {
+ &:first-child {
margin-right: 16px;
background-color: ${props => props.theme?.colorGreyLight};
@@ -123,7 +123,7 @@ const ModalFooter = woowahan.div`
}
}
- :last-child {
+ &:last-child {
background-color: ${props => props.theme?.colorPrimaryLight};
&:hover {
@@ -136,7 +136,7 @@ const ModalFooter = woowahan.div`
const Modal: FC = ({ type, header, body, onCancel, onConfirm }) => {
return (
-
+
{header}
diff --git a/client/src/components/common/navbar.tsx b/client/src/components/common/navbar.tsx
index 69103b1..077ad88 100644
--- a/client/src/components/common/navbar.tsx
+++ b/client/src/components/common/navbar.tsx
@@ -78,7 +78,7 @@ const Navbar: FC = ({ white = false, mobile = false, userId, onLogo
) : (
- {mobile ? : '로그인'}
+ {mobile ? : '로그인'}
)}
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index e1bf023..c4e6b19 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,5 +1,5 @@
-import woowahan from 'lib/woowahan-components';
import React, { useState, FC } from 'react';
+import woowahan from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import { IMenu } from 'types/category';
import { SMART_MENU_LARGE_WIDTH, SMART_MENU_SMALL_WIDTH, SMART_MENU_BLOCK_DELAY } from '../../constants';
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index ef8464c..4bc0847 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -1,5 +1,5 @@
-import woowahan from 'lib/woowahan-components';
import React, { FC } from 'react';
+import woowahan from 'lib/woowahan-components';
import { IMenu } from 'types/category';
import { SMART_MENU_BLOCK_DELAY } from '../../constants';
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index f5a8063..170007c 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -1,5 +1,5 @@
-import woowahan from 'lib/woowahan-components';
import React, { FC } from 'react';
+import woowahan from 'lib/woowahan-components';
import { IMenu } from 'types/category';
interface MediumMenuProps {
diff --git a/client/src/components/smart-menu/small-menu.tsx b/client/src/components/smart-menu/small-menu.tsx
index 1ea9810..9990743 100644
--- a/client/src/components/smart-menu/small-menu.tsx
+++ b/client/src/components/smart-menu/small-menu.tsx
@@ -1,5 +1,5 @@
-import woowahan from 'lib/woowahan-components';
import React, { FC } from 'react';
+import woowahan from 'lib/woowahan-components';
import { IMenu } from 'types/category';
interface SmallMenuProps {
diff --git a/client/src/styles/styled.d.ts b/client/src/styles/styled.d.ts
deleted file mode 100644
index 1bd8d1f..0000000
--- a/client/src/styles/styled.d.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import 'styled-components';
-
-declare module 'styled-components' {
- export interface DefaultTheme {
- mobile: string;
- tablet: string;
- laptop: string;
-
- colorWhite: string;
- colorOffWhite: string;
- colorBlack: string;
- colorSoftBlack: string;
-
- colorBg: string;
- colorFooter: string;
- colorPlaceholder: string;
- colorError: string;
-
- colorLine: string;
- colorLineLight: string;
- colorLineDark: string;
-
- colorTextBrown: string;
- colorTextBrownLight: string;
- colorTextBeige: string;
-
- colorPrimary: string;
- colorPrimaryLight: string;
- colorPrimaryDark: string;
-
- colorPointDarkGreen: string;
- colorPointGreen: string;
- colorPointBeige: string;
- colorPointBeigeLight: string;
- colorPointRed: string;
- colorPointAqua: string;
-
- colorGreyDark: string;
- colorGreyMid: string;
- colorGreyLight: string;
-
- colorGithub: string;
-
- fontBasic: string;
- fontEuljiro: string;
- fontEuljiro10: string;
- fontHanna: string;
- fontHannaAir: string;
-
- weightReg: string;
- weightMid: string;
- weightBold: string;
- }
-}
From 1225d17e75eb3a8da3f89800bcc0e7f2771829c4 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 10:12:18 +0900
Subject: [PATCH 010/163] =?UTF-8?q?refactor:=20=EC=BB=A4=EC=8A=A4=ED=85=80?=
=?UTF-8?q?=20=ED=81=B4=EB=9E=98=EC=8A=A4=EB=AA=85=20=EC=A0=81=EC=9A=A9=20?=
=?UTF-8?q?=EB=B0=8F=20=ED=85=8C=EB=A7=88=20=EC=88=A8=EA=B8=B0=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../woowahan-components/components/woowahan-component.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/client/src/lib/woowahan-components/components/woowahan-component.tsx b/client/src/lib/woowahan-components/components/woowahan-component.tsx
index 4ff6159..7289092 100644
--- a/client/src/lib/woowahan-components/components/woowahan-component.tsx
+++ b/client/src/lib/woowahan-components/components/woowahan-component.tsx
@@ -47,7 +47,10 @@ const woowahanComponent = (tag: string): TaggedTemplateType => {
}
const { children } = props;
- const ReactElement = React.createElement(tag, { className, theme, ...props }, children);
+ if (props.className) {
+ className += ` ${props.className}`;
+ }
+ const ReactElement = React.createElement(tag, { ...props, className }, children);
return ReactElement;
};
From 184e47905c653f6d5db6521e21cc860a1f1aa8ba Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 10:12:35 +0900
Subject: [PATCH 011/163] =?UTF-8?q?chore:=20=EB=AA=A8=EB=8B=AC=20=ED=81=B4?=
=?UTF-8?q?=EB=9E=98=EC=8A=A4=EB=AA=85=20=EB=8B=A4=EC=8B=9C=20=EB=B3=B5?=
=?UTF-8?q?=EA=B5=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/common/modal.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/common/modal.tsx b/client/src/components/common/modal.tsx
index 7a0da06..dc8eb5f 100644
--- a/client/src/components/common/modal.tsx
+++ b/client/src/components/common/modal.tsx
@@ -136,7 +136,7 @@ const ModalFooter = woowahan.div`
const Modal: FC = ({ type, header, body, onCancel, onConfirm }) => {
return (
-
+
{header}
From a8f6eef7b0f4d60f287b9b78a7ad2bf2fd5bd57c Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 10:26:06 +0900
Subject: [PATCH 012/163] =?UTF-8?q?refactor:=20css=20reset,=20css=20normal?=
=?UTF-8?q?izer=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/styles/theme.tsx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/client/src/styles/theme.tsx b/client/src/styles/theme.tsx
index 5d49ed3..54b7dd7 100644
--- a/client/src/styles/theme.tsx
+++ b/client/src/styles/theme.tsx
@@ -1,6 +1,5 @@
import React, { FC } from 'react';
import { ThemeProvider, createGlobalStyle } from 'lib/woowahan-components';
-import reset from 'styled-reset';
import BMEULJIRO from '../assets/fonts/BMEULJIRO.woff';
import BMEULJIRO10years from '../assets/fonts/BMEULJIRO10yearslater.woff';
import BMHANNA from '../assets/fonts/BMHANNA11years.woff';
@@ -59,6 +58,8 @@ const theme = {
const GlobalStyle = createGlobalStyle`
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');
+ @import url('https://meyerweb.com/eric/tools/css/reset/reset.css');
+ @import url('https://unpkg.com/sanitize.css');
@font-face {
font-family: 'BMEULJIRO';
@@ -80,8 +81,6 @@ const GlobalStyle = createGlobalStyle`
src: url(${BMHANNAAir}) format('woff');
}
- ${reset[0] as string}
-
#root {
width: 100%;
height: 100vh;
From b43e3efc86ff980895e822c083ebcbb7bdf190e3 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 10:26:24 +0900
Subject: [PATCH 013/163] =?UTF-8?q?chore:=20styled=20components=20?=
=?UTF-8?q?=EC=A0=9C=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/package.json | 2 -
client/yarn.lock | 98 +++------------------------------------------
2 files changed, 6 insertions(+), 94 deletions(-)
diff --git a/client/package.json b/client/package.json
index bb0479d..2e942f4 100644
--- a/client/package.json
+++ b/client/package.json
@@ -34,7 +34,6 @@
"redux-saga": "^1.1.3",
"redux-saga-test-plan": "^4.0.3",
"sanitize-html": "^2.4.0",
- "styled-components": "^5.3.0",
"styled-reset": "^4.3.4",
"stylis": "^4.0.10"
},
@@ -50,7 +49,6 @@
"@types/react": "^17.0.17",
"@types/react-dom": "^17.0.9",
"@types/react-redux": "^7.1.18",
- "@types/styled-components": "^5.1.12",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"babel-cli": "^6.26.0",
diff --git a/client/yarn.lock b/client/yarn.lock
index 0278893..529e9dd 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -67,7 +67,7 @@
jsesc "^2.5.1"
source-map "^0.5.0"
-"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.14.5":
+"@babel/helper-annotate-as-pure@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.14.5.tgz#7bf478ec3b71726d56a8ca5775b046fc29879e61"
integrity sha512-EivH9EgBIb+G8ij1B2jAwSH36WnGvkQSEC6CkX/6v6ZFlw5fVOHvsgGF4uiEHO2GzMvunZb6tDLQEQSdrdocrA==
@@ -163,7 +163,7 @@
dependencies:
"@babel/types" "^7.15.0"
-"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5":
+"@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz#6d1a44df6a38c957aa7c312da076429f11b422f3"
integrity sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==
@@ -967,7 +967,7 @@
"@babel/parser" "^7.14.5"
"@babel/types" "^7.14.5"
-"@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.14.5", "@babel/traverse@^7.15.0", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.2":
+"@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.14.5", "@babel/traverse@^7.15.0", "@babel/traverse@^7.7.2":
version "7.15.0"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.0.tgz#4cca838fd1b2a03283c1f38e141f639d60b3fc98"
integrity sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw==
@@ -1000,28 +1000,6 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz#90420f9f9c6d3987f176a19a7d8e764271a2f55d"
integrity sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==
-"@emotion/is-prop-valid@^0.8.8":
- version "0.8.8"
- resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz#db28b1c4368a259b60a97311d6a952d4fd01ac1a"
- integrity sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==
- dependencies:
- "@emotion/memoize" "0.7.4"
-
-"@emotion/memoize@0.7.4":
- version "0.7.4"
- resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb"
- integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==
-
-"@emotion/stylis@^0.8.4":
- version "0.8.5"
- resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.5.tgz#deacb389bd6ee77d1e7fcaccce9e16c5c7e78e04"
- integrity sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==
-
-"@emotion/unitless@^0.7.4":
- version "0.7.5"
- resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed"
- integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==
-
"@eslint/eslintrc@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
@@ -1474,7 +1452,7 @@
dependencies:
"@types/node" "*"
-"@types/hoist-non-react-statics@*", "@types/hoist-non-react-statics@^3.3.0":
+"@types/hoist-non-react-statics@^3.3.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==
@@ -1582,15 +1560,6 @@
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==
-"@types/styled-components@^5.1.12":
- version "5.1.12"
- resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.12.tgz#1a3679942746adecd1e736bfc47aea2c938a7d9a"
- integrity sha512-sTjc0+gMl08JvOHchQKgEGbbiSexSvWg5khUNSH4kosb7Tl4782AtfWMkAhQmeXMg2vIn6PthGVHFW+U/Dpihg==
- dependencies:
- "@types/hoist-non-react-statics" "*"
- "@types/react" "*"
- csstype "^3.0.2"
-
"@types/stylis@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.0.1.tgz#ed14588039b713fc3183cfa0e95033e86e5e1aa2"
@@ -2336,21 +2305,6 @@ babel-plugin-polyfill-regenerator@^0.2.2:
dependencies:
"@babel/helper-define-polyfill-provider" "^0.2.2"
-"babel-plugin-styled-components@>= 1.12.0":
- version "1.13.2"
- resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.13.2.tgz#ebe0e6deff51d7f93fceda1819e9b96aeb88278d"
- integrity sha512-Vb1R3d4g+MUfPQPVDMCGjm3cDocJEUTR7Xq7QS95JWWeksN1wdFRYpD2kulDgI3Huuaf1CZd+NK4KQmqUFh5dA==
- dependencies:
- "@babel/helper-annotate-as-pure" "^7.0.0"
- "@babel/helper-module-imports" "^7.0.0"
- babel-plugin-syntax-jsx "^6.18.0"
- lodash "^4.17.11"
-
-babel-plugin-syntax-jsx@^6.18.0:
- version "6.18.0"
- resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
- integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=
-
babel-polyfill@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
@@ -2662,11 +2616,6 @@ camelcase@^6.2.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809"
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
-camelize@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
- integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
-
caniuse-api@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0"
@@ -3028,11 +2977,6 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"
-css-color-keywords@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05"
- integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=
-
css-color-names@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
@@ -3088,15 +3032,6 @@ css-select@^4.1.3:
domutils "^2.6.0"
nth-check "^2.0.0"
-css-to-react-native@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-3.0.0.tgz#62dbe678072a824a689bcfee011fc96e02a7d756"
- integrity sha512-Ro1yETZA813eoyUp2GDBhG2j+YggidUmzO1/v9eYBKR2EHVEniE2MI/NqpTQ954BMpTPZFsGNPm46qFB9dpaPQ==
- dependencies:
- camelize "^1.0.0"
- css-color-keywords "^1.0.0"
- postcss-value-parser "^4.0.2"
-
css-tree@^1.1.2:
version "1.1.3"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.1.3.tgz#eb4870fb6fd7707327ec95c2ff2ab09b5e8db91d"
@@ -4515,7 +4450,7 @@ hex-color-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==
-hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
+hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
@@ -7798,11 +7733,6 @@ shallow-clone@^3.0.0:
dependencies:
kind-of "^6.0.2"
-shallowequal@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"
- integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==
-
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
@@ -8194,22 +8124,6 @@ style-loader@^3.2.1:
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-3.2.1.tgz#63cb920ec145c8669e9a50e92961452a1ef5dcde"
integrity sha512-1k9ZosJCRFaRbY6hH49JFlRB0fVSbmnyq1iTPjNxUmGVjBNEmwrrHPenhlp+Lgo51BojHSf6pl2FcqYaN3PfVg==
-styled-components@^5.3.0:
- version "5.3.0"
- resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.3.0.tgz#e47c3d3e9ddfff539f118a3dd0fd4f8f4fb25727"
- integrity sha512-bPJKwZCHjJPf/hwTJl6TbkSZg/3evha+XPEizrZUGb535jLImwDUdjTNxXqjjaASt2M4qO4AVfoHJNe3XB/tpQ==
- dependencies:
- "@babel/helper-module-imports" "^7.0.0"
- "@babel/traverse" "^7.4.5"
- "@emotion/is-prop-valid" "^0.8.8"
- "@emotion/stylis" "^0.8.4"
- "@emotion/unitless" "^0.7.4"
- babel-plugin-styled-components ">= 1.12.0"
- css-to-react-native "^3.0.0"
- hoist-non-react-statics "^3.0.0"
- shallowequal "^1.1.0"
- supports-color "^5.5.0"
-
styled-reset@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/styled-reset/-/styled-reset-4.3.4.tgz#87b6f43caa3f83a5f9dc63773c13b8bb71efbe69"
@@ -8233,7 +8147,7 @@ supports-color@^2.0.0:
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
-supports-color@^5.3.0, supports-color@^5.5.0:
+supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
From e76201d3e22db90b668f20320fbde4e21dd60bc2 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Wed, 18 Aug 2021 10:51:41 +0900
Subject: [PATCH 014/163] =?UTF-8?q?fix:=20boolean=20=ED=94=84=EB=A1=9C?=
=?UTF-8?q?=ED=8D=BC=ED=8B=B0=20=EC=82=AC=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/woowahan-component.tsx | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/client/src/lib/woowahan-components/components/woowahan-component.tsx b/client/src/lib/woowahan-components/components/woowahan-component.tsx
index 7289092..2eff52f 100644
--- a/client/src/lib/woowahan-components/components/woowahan-component.tsx
+++ b/client/src/lib/woowahan-components/components/woowahan-component.tsx
@@ -7,6 +7,7 @@ import parseString, { IProps, ExpType } from '../utils/parse-string';
import { IThemeContext } from './theme-provider';
export type TaggedTemplateType = (styleString: TemplateStringsArray, ...exps: ExpType) => FC;
+type ElementProps = { [key: string]: unknown };
const woowahanComponent = (tag: string): TaggedTemplateType => {
const classMap = new Map();
@@ -50,7 +51,18 @@ const woowahanComponent = (tag: string): TaggedTemplateType => {
if (props.className) {
className += ` ${props.className}`;
}
- const ReactElement = React.createElement(tag, { ...props, className }, children);
+
+ const newProps: ElementProps = {};
+
+ Object.entries(props).forEach(([key, value]) => {
+ if (typeof value === 'boolean') {
+ newProps[key] = (value as boolean).toString();
+ } else {
+ newProps[key] = value;
+ }
+ });
+
+ const ReactElement = React.createElement(tag, { ...newProps, className }, children);
return ReactElement;
};
From 3401232536288d0561ab309bdd4d01accc1748a5 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Tue, 17 Aug 2021 01:13:59 +0900
Subject: [PATCH 015/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 상품 아이템 컴포넌트를 생성하여 UI 구성
---
client/src/components/item/index.tsx | 60 ++++++++++++++++++++++++++++
client/src/pages/main-page.tsx | 30 ++++++++++++++
client/src/styles/theme.tsx | 2 +-
client/src/utils/index.ts | 3 ++
4 files changed, 94 insertions(+), 1 deletion(-)
create mode 100644 client/src/components/item/index.tsx
create mode 100644 client/src/utils/index.ts
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
new file mode 100644
index 0000000..f84dadf
--- /dev/null
+++ b/client/src/components/item/index.tsx
@@ -0,0 +1,60 @@
+import React, { FC } from 'react';
+import styled from 'styled-components';
+import { formatPrice } from 'utils';
+
+interface ItemProps {
+ thumbnail: string;
+ title: string;
+ price: number;
+}
+
+const Container = styled.div`
+ width: 230px;
+ height: 380px;
+ padding: 5px;
+ background-color: ${props => props.theme.colorPointDarkGreen};
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+`;
+
+const Thumbnail = styled.img`
+ width: 100%;
+ height: 300px;
+ object-fit: cover;
+`;
+
+const Info = styled.div`
+ margin-left: 2px;
+ margin-bottom: 6px;
+ font-family: ${props => props.theme.fontEuljiro};
+ color: ${props => props.theme.colorOffWhite};
+
+ .title {
+ width: 220px;
+ font-size: 18px;
+ line-height: 24px;
+ letter-spacing: 0.5px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .price {
+ font-size: 30px;
+ }
+`;
+
+const Item: FC = ({ thumbnail, title, price }) => {
+ return (
+
+
+
+ {title}
+ {formatPrice(price)}원
+
+
+ );
+};
+
+export default Item;
diff --git a/client/src/pages/main-page.tsx b/client/src/pages/main-page.tsx
index 26e6ab2..e3d5913 100644
--- a/client/src/pages/main-page.tsx
+++ b/client/src/pages/main-page.tsx
@@ -3,6 +3,14 @@ import useWindowSize from 'hooks/use-window-size';
import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
+import Item from 'components/item';
+import styled from 'styled-components';
+
+const Div = styled.div`
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+`;
const MainPage = (): ReactElement => {
const { width } = useWindowSize();
@@ -13,6 +21,28 @@ const MainPage = (): ReactElement => {
+
+
+
+
+
+
diff --git a/client/src/styles/theme.tsx b/client/src/styles/theme.tsx
index 54b7dd7..fa68ef7 100644
--- a/client/src/styles/theme.tsx
+++ b/client/src/styles/theme.tsx
@@ -32,7 +32,7 @@ const theme = {
colorPrimaryLight: '#A0E1E0',
colorPrimaryDark: '#219A95',
- colorPointDarkGreen: '#11403E',
+ colorPointDarkGreen: '#124a48',
colorPointGreen: '#348011',
colorPointBeige: '#BAA482',
colorPointBeigeLight: '#F7EAD7',
diff --git a/client/src/utils/index.ts b/client/src/utils/index.ts
new file mode 100644
index 0000000..841dca9
--- /dev/null
+++ b/client/src/utils/index.ts
@@ -0,0 +1,3 @@
+export const formatPrice = (price: number): string => {
+ return price.toLocaleString('ko-KR');
+};
From 9af56b0a809a447fb0c8bcb1d2c9d9e0f4d8f805 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Tue, 17 Aug 2021 10:32:35 +0900
Subject: [PATCH 016/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=BB=B4=ED=8F=AC=EB=84=8C?=
=?UTF-8?q?=ED=8A=B8=20=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 아이템 컨테이너에서 데이터를 받아 아이템 리스트로 내려줌
- 아이템 리스트 컴포넌트 레이아웃 설정
---
client/src/components/item/item-list.tsx | 37 ++++++++++++
client/src/containers/item-container.tsx | 76 ++++++++++++++++++++++++
client/src/pages/main-page.tsx | 32 +---------
3 files changed, 115 insertions(+), 30 deletions(-)
create mode 100644 client/src/components/item/item-list.tsx
create mode 100644 client/src/containers/item-container.tsx
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
new file mode 100644
index 0000000..802f04c
--- /dev/null
+++ b/client/src/components/item/item-list.tsx
@@ -0,0 +1,37 @@
+import React, { FC } from 'react';
+import styled from 'styled-components';
+import { IItem } from 'types';
+import Item from 'components/item';
+
+interface ItemListProps {
+ items: IItem[];
+ isLoading: boolean;
+}
+
+const Wrapper = styled.div`
+ width: 100%;
+ display: flex;
+ flex-wrap: wrap;
+ margin-top: 20px;
+ margin-bottom: 50px;
+`;
+
+const ItemWrapper = styled.div`
+ margin: 8px 5px;
+`;
+
+const ItemList: FC = ({ items }) => {
+ return (
+
+ {items.map(item => {
+ return (
+
+
+
+ );
+ })}
+
+ );
+};
+
+export default ItemList;
diff --git a/client/src/containers/item-container.tsx b/client/src/containers/item-container.tsx
new file mode 100644
index 0000000..9173e8b
--- /dev/null
+++ b/client/src/containers/item-container.tsx
@@ -0,0 +1,76 @@
+import React, { FC } from 'react';
+import ItemList from 'components/item/item-list';
+import { IItem } from 'types';
+
+const ITEM_DUMMY: IItem[] = [
+ {
+ id: 1,
+ thumbnail:
+ 'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
+ title: '맥주짠 세트',
+ price: 10900,
+ },
+ {
+ id: 2,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
+ title: 'ㅋㅋ슬리퍼 블랙',
+ price: 21000,
+ },
+ {
+ id: 3,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
+ title: '커피찌꺼기를 재활용해 만든 연필',
+ price: 2500,
+ },
+ {
+ id: 4,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
+ title: '반반휴지. 물반휴지반',
+ price: 1500,
+ },
+ {
+ id: 5,
+ thumbnail:
+ 'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
+ title: '맥주짠 세트',
+ price: 10900,
+ },
+ {
+ id: 6,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
+ title: 'ㅋㅋ슬리퍼 블랙',
+ price: 21000,
+ },
+ {
+ id: 7,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
+ title: '커피찌꺼기를 재활용해 만든 연필',
+ price: 2500,
+ },
+ {
+ id: 8,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
+ title: '반반휴지. 물반휴지반',
+ price: 1500,
+ },
+ {
+ id: 9,
+ thumbnail:
+ 'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
+ title: '맥주짠 세트',
+ price: 10900,
+ },
+ {
+ id: 10,
+ thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
+ title: 'ㅋㅋ슬리퍼 블랙',
+ price: 21000,
+ },
+];
+
+const ItemContainer: FC = () => {
+ /* TODO: get items method - saga */
+ return ;
+};
+
+export default ItemContainer;
diff --git a/client/src/pages/main-page.tsx b/client/src/pages/main-page.tsx
index e3d5913..5f66be8 100644
--- a/client/src/pages/main-page.tsx
+++ b/client/src/pages/main-page.tsx
@@ -2,15 +2,8 @@ import React, { ReactElement } from 'react';
import useWindowSize from 'hooks/use-window-size';
import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
+import ItemContainer from 'containers/item-container';
import { Layout, Footer } from 'components';
-import Item from 'components/item';
-import styled from 'styled-components';
-
-const Div = styled.div`
- width: 100%;
- display: flex;
- justify-content: space-between;
-`;
const MainPage = (): ReactElement => {
const { width } = useWindowSize();
@@ -21,28 +14,7 @@ const MainPage = (): ReactElement => {
-
-
-
-
-
-
+
From ad104ff7c77f123c7e6a067876532216226dbd37 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Tue, 17 Aug 2021 17:28:44 +0900
Subject: [PATCH 017/163] =?UTF-8?q?style:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=A0=95=EB=A0=AC=20=EA=B5=AC=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/item-list.tsx | 18 ++++++------------
client/src/containers/item-container.tsx | 2 +-
client/src/types/item.ts | 6 ++++++
3 files changed, 13 insertions(+), 13 deletions(-)
create mode 100644 client/src/types/item.ts
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index 802f04c..ef16108 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import styled from 'styled-components';
-import { IItem } from 'types';
+import { IItem } from 'types/item';
import Item from 'components/item';
interface ItemListProps {
@@ -10,25 +10,19 @@ interface ItemListProps {
const Wrapper = styled.div`
width: 100%;
- display: flex;
- flex-wrap: wrap;
margin-top: 20px;
margin-bottom: 50px;
-`;
-
-const ItemWrapper = styled.div`
- margin: 8px 5px;
+ display: grid;
+ grid-template-columns: repeat(auto-fit, 230px);
+ grid-gap: 10px 16px;
+ justify-content: center;
`;
const ItemList: FC = ({ items }) => {
return (
{items.map(item => {
- return (
-
-
-
- );
+ return ;
})}
);
diff --git a/client/src/containers/item-container.tsx b/client/src/containers/item-container.tsx
index 9173e8b..2b55f07 100644
--- a/client/src/containers/item-container.tsx
+++ b/client/src/containers/item-container.tsx
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import ItemList from 'components/item/item-list';
-import { IItem } from 'types';
+import { IItem } from 'types/item';
const ITEM_DUMMY: IItem[] = [
{
diff --git a/client/src/types/item.ts b/client/src/types/item.ts
new file mode 100644
index 0000000..cc41eb1
--- /dev/null
+++ b/client/src/types/item.ts
@@ -0,0 +1,6 @@
+export interface IItem {
+ id: number;
+ thumbnail: string;
+ title: string;
+ price: number;
+}
From fd045ab7c2d86161221011f83dacc2676eb0915a Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Tue, 17 Aug 2021 17:40:46 +0900
Subject: [PATCH 018/163] =?UTF-8?q?style:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EB=B0=98=EC=9D=91=ED=98=95=20=EC=8A=A4=ED=83=80=EC=9D=BC?=
=?UTF-8?q?=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 창 크기에 따라 아이템 크기가 달라지도록 수정
---
client/src/components/item/index.tsx | 40 ++++++++++++++++++++++++
client/src/components/item/item-list.tsx | 8 +++++
2 files changed, 48 insertions(+)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index f84dadf..80bd0dd 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -16,12 +16,30 @@ const Container = styled.div`
display: flex;
flex-direction: column;
justify-content: space-between;
+
+ ${props => props.theme.mobile} {
+ width: 150px;
+ height: 280px;
+ }
+
+ ${props => props.theme.tablet} {
+ width: 180px;
+ height: 320px;
+ }
`;
const Thumbnail = styled.img`
width: 100%;
height: 300px;
object-fit: cover;
+
+ ${props => props.theme.mobile} {
+ height: 220px;
+ }
+
+ ${props => props.theme.tablet} {
+ height: 250px;
+ }
`;
const Info = styled.div`
@@ -43,6 +61,28 @@ const Info = styled.div`
.price {
font-size: 30px;
}
+
+ ${props => props.theme.mobile} {
+ .title {
+ width: 140px;
+ font-size: 14px;
+ }
+
+ .price {
+ font-size: 22px;
+ }
+ }
+
+ ${props => props.theme.tablet} {
+ .title {
+ width: 170px;
+ font-size: 16px;
+ }
+
+ .price {
+ font-size: 26px;
+ }
+ }
`;
const Item: FC = ({ thumbnail, title, price }) => {
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index ef16108..f334807 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -16,6 +16,14 @@ const Wrapper = styled.div`
grid-template-columns: repeat(auto-fit, 230px);
grid-gap: 10px 16px;
justify-content: center;
+
+ ${props => props.theme.mobile} {
+ grid-template-columns: repeat(auto-fit, 150px);
+ }
+
+ ${props => props.theme.tablet} {
+ grid-template-columns: repeat(auto-fit, 180px);
+ }
`;
const ItemList: FC = ({ items }) => {
From 7743a657d70a616da72b5f6e40c6151dd2021852 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Tue, 17 Aug 2021 23:56:01 +0900
Subject: [PATCH 019/163] =?UTF-8?q?style:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EB=A7=88=EC=9A=B0=EC=8A=A4=20=ED=98=B8=EB=B2=84=20=EC=8B=9C=20?=
=?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20scale=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index 80bd0dd..c4d1038 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -9,6 +9,7 @@ interface ItemProps {
}
const Container = styled.div`
+ cursor: pointer;
width: 230px;
height: 380px;
padding: 5px;
@@ -26,12 +27,25 @@ const Container = styled.div`
width: 180px;
height: 320px;
}
+
+ &:hover {
+ img {
+ transform: scale(1.1);
+ transition: 0.5s;
+ }
+ }
`;
-const Thumbnail = styled.img`
+const Thumbnail = styled.div`
width: 100%;
height: 300px;
- object-fit: cover;
+ overflow: hidden;
+
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
${props => props.theme.mobile} {
height: 220px;
@@ -88,7 +102,9 @@ const Info = styled.div`
const Item: FC = ({ thumbnail, title, price }) => {
return (
-
+
+
+
{title}
{formatPrice(price)}원
From aa6ab60a27a204e9968e6854e701a1c3f41d86a6 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 00:13:13 +0900
Subject: [PATCH 020/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=A2=8B=EC=95=84=EC=9A=94=20=EC=95=84=EC=9D=B4=EC=BD=98=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 33 +++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index c4d1038..470887e 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -1,6 +1,8 @@
-import React, { FC } from 'react';
+import React, { FC, useState } from 'react';
import styled from 'styled-components';
import { formatPrice } from 'utils';
+import likeIcon from 'assets/icons/like.png';
+import likeFilledIcon from 'assets/icons/like-filled.png';
interface ItemProps {
thumbnail: string;
@@ -17,6 +19,7 @@ const Container = styled.div`
display: flex;
flex-direction: column;
justify-content: space-between;
+ position: relative;
${props => props.theme.mobile} {
width: 150px;
@@ -28,11 +31,19 @@ const Container = styled.div`
height: 320px;
}
+ img.like-empty {
+ display: none;
+ }
+
&:hover {
- img {
+ img.thumbnail-img {
transform: scale(1.1);
transition: 0.5s;
}
+
+ img.like-empty {
+ display: inline;
+ }
}
`;
@@ -99,16 +110,32 @@ const Info = styled.div`
}
`;
+const LikeWrapper = styled.div`
+ img {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ width: 30px;
+ }
+`;
+
const Item: FC = ({ thumbnail, title, price }) => {
+ const [isLiked, setIsLiked] = useState(false);
+
+ const toggleLike = () => setIsLiked(!isLiked);
+
return (
-
+
{title}
{formatPrice(price)}원
+
+ {isLiked ? : }
+
);
};
From 0ea17c77589a24aa510fdd56ccce7206097fd850 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 00:37:39 +0900
Subject: [PATCH 021/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=B1=83=EC=A7=80=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 48 ++++++++++++++++++++----
client/src/components/item/item-list.tsx | 13 ++++++-
client/src/containers/item-container.tsx | 6 +++
client/src/types/item.ts | 4 ++
4 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index 470887e..10de7c3 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -3,19 +3,35 @@ import styled from 'styled-components';
import { formatPrice } from 'utils';
import likeIcon from 'assets/icons/like.png';
import likeFilledIcon from 'assets/icons/like-filled.png';
+import badgeBestIcon from 'assets/icons/badge_best.png';
+import badgeGreenIcon from 'assets/icons/badge_green.png';
+import badgeNewIcon from 'assets/icons/badge_new.png';
+import badgeSaleIcon from 'assets/icons/badge_sale.png';
interface ItemProps {
thumbnail: string;
title: string;
price: number;
+ isBest?: boolean;
+ isGreen?: boolean;
+ isNew?: boolean;
+ isSale?: boolean;
}
-const Container = styled.div`
+interface ContainerProps {
+ bgColor?: 'red' | 'beige' | 'green';
+}
+
+const Container = styled.div`
cursor: pointer;
width: 230px;
height: 380px;
padding: 5px;
- background-color: ${props => props.theme.colorPointDarkGreen};
+ background-color: ${props => {
+ if (props.bgColor === 'red') return props.theme.colorPointRed;
+ if (props.bgColor === 'beige') return props.theme.colorPointBeige;
+ return props.theme.colorPointDarkGreen;
+ }};
display: flex;
flex-direction: column;
justify-content: space-between;
@@ -110,22 +126,34 @@ const Info = styled.div`
}
`;
+const BadgeWrapper = styled.div`
+ position: absolute;
+ top: 10px;
+ left: 10px;
+
+ img {
+ height: 20px;
+ margin-right: 5px;
+ }
+`;
+
const LikeWrapper = styled.div`
+ position: absolute;
+ top: 10px;
+ right: 10px;
+
img {
- position: absolute;
- top: 10px;
- right: 10px;
width: 30px;
}
`;
-const Item: FC = ({ thumbnail, title, price }) => {
+const Item: FC = ({ thumbnail, title, price, isBest, isGreen, isNew, isSale }) => {
const [isLiked, setIsLiked] = useState(false);
const toggleLike = () => setIsLiked(!isLiked);
return (
-
+
@@ -133,6 +161,12 @@ const Item: FC = ({ thumbnail, title, price }) => {
{title}
{formatPrice(price)}원
+
+ {isBest && }
+ {isGreen && }
+ {isNew && }
+ {isSale && }
+
{isLiked ? : }
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index f334807..e105014 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -30,7 +30,18 @@ const ItemList: FC = ({ items }) => {
return (
{items.map(item => {
- return ;
+ return (
+
+ );
})}
);
diff --git a/client/src/containers/item-container.tsx b/client/src/containers/item-container.tsx
index 2b55f07..b50d720 100644
--- a/client/src/containers/item-container.tsx
+++ b/client/src/containers/item-container.tsx
@@ -9,24 +9,29 @@ const ITEM_DUMMY: IItem[] = [
'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
title: '맥주짠 세트',
price: 10900,
+ isSale: true,
},
{
id: 2,
thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
title: 'ㅋㅋ슬리퍼 블랙',
price: 21000,
+ isBest: true,
},
{
id: 3,
thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
title: '커피찌꺼기를 재활용해 만든 연필',
price: 2500,
+ isGreen: true,
+ isNew: true,
},
{
id: 4,
thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
title: '반반휴지. 물반휴지반',
price: 1500,
+ isBest: true,
},
{
id: 5,
@@ -34,6 +39,7 @@ const ITEM_DUMMY: IItem[] = [
'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
title: '맥주짠 세트',
price: 10900,
+ isSale: true,
},
{
id: 6,
diff --git a/client/src/types/item.ts b/client/src/types/item.ts
index cc41eb1..85bce3f 100644
--- a/client/src/types/item.ts
+++ b/client/src/types/item.ts
@@ -3,4 +3,8 @@ export interface IItem {
thumbnail: string;
title: string;
price: number;
+ isBest?: boolean;
+ isGreen?: boolean;
+ isNew?: boolean;
+ isSale?: boolean;
}
From d44c825ba8a3680f3a604ba2a49052d182b2a9b2 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 00:55:40 +0900
Subject: [PATCH 022/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=84=B8=EC=9D=BC=20=EA=B8=88=EC=95=A1=20=ED=91=9C=EC=8B=9C=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 61 +++++++++++++++++++++-
client/src/components/item/item-list.tsx | 2 +
client/src/components/smart-menu/index.tsx | 5 +-
client/src/containers/item-container.tsx | 8 ++-
client/src/types/item.ts | 2 +
5 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index 10de7c3..e48b374 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -16,6 +16,8 @@ interface ItemProps {
isGreen?: boolean;
isNew?: boolean;
isSale?: boolean;
+ salePercent?: number;
+ originalPrice?: number;
}
interface ContainerProps {
@@ -101,6 +103,12 @@ const Info = styled.div`
.price {
font-size: 30px;
+
+ span {
+ font-size: 22px;
+ color: ${props => props.theme.colorGreyMid};
+ text-decoration: line-through;
+ }
}
${props => props.theme.mobile} {
@@ -111,6 +119,10 @@ const Info = styled.div`
.price {
font-size: 22px;
+
+ span {
+ font-size: 14px;
+ }
}
}
@@ -122,6 +134,38 @@ const Info = styled.div`
.price {
font-size: 26px;
+
+ span {
+ font-size: 18px;
+ }
+ }
+ }
+`;
+
+const SaleWrapper = styled.div`
+ position: absolute;
+ top: 297px;
+ right: 10px;
+
+ span {
+ font-size: 24px;
+ font-family: ${props => props.theme.fontEuljiro};
+ color: ${props => props.theme.colorWhite};
+ }
+
+ ${props => props.theme.mobile} {
+ top: 217px;
+
+ span {
+ font-size: 20px;
+ }
+ }
+
+ ${props => props.theme.tablet} {
+ top: 247px;
+
+ span {
+ font-size: 22px;
}
}
`;
@@ -147,7 +191,17 @@ const LikeWrapper = styled.div`
}
`;
-const Item: FC = ({ thumbnail, title, price, isBest, isGreen, isNew, isSale }) => {
+const Item: FC = ({
+ thumbnail,
+ title,
+ price,
+ isBest,
+ isGreen,
+ isNew,
+ isSale,
+ salePercent,
+ originalPrice,
+}) => {
const [isLiked, setIsLiked] = useState(false);
const toggleLike = () => setIsLiked(!isLiked);
@@ -159,8 +213,11 @@ const Item: FC = ({ thumbnail, title, price, isBest, isGreen, isNew,
{title}
- {formatPrice(price)}원
+
+ {formatPrice(price)}원 {isSale && originalPrice && {formatPrice(originalPrice)}원}
+
+ {isSale && salePercent && {salePercent}%}
{isBest && }
{isGreen && }
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index e105014..edb6083 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -40,6 +40,8 @@ const ItemList: FC = ({ items }) => {
isGreen={item.isGreen}
isNew={item.isNew}
isSale={item.isSale}
+ salePercent={item.salePercent}
+ originalPrice={item.originalPrice}
/>
);
})}
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index c4e6b19..fda93e2 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -24,8 +24,9 @@ const MenuDiv = woowahan.div`
background-color: ${({ theme }) => theme?.colorBg};
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
- color: ${({ theme }) => theme?.colorBlack};
- border: 3px solid ${({ theme }) => theme?.colorLineDark};
+ color: ${({ theme }) => theme.colorBlack};
+ border: 3px solid ${({ theme }) => theme.colorLineDark};
+ z-index: 1000;
`;
const MenuTitle = woowahan.div`
diff --git a/client/src/containers/item-container.tsx b/client/src/containers/item-container.tsx
index b50d720..5d705da 100644
--- a/client/src/containers/item-container.tsx
+++ b/client/src/containers/item-container.tsx
@@ -8,8 +8,10 @@ const ITEM_DUMMY: IItem[] = [
thumbnail:
'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
title: '맥주짠 세트',
- price: 10900,
+ price: 9810,
isSale: true,
+ salePercent: 10,
+ originalPrice: 10900,
},
{
id: 2,
@@ -38,8 +40,10 @@ const ITEM_DUMMY: IItem[] = [
thumbnail:
'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
title: '맥주짠 세트',
- price: 10900,
+ price: 9810,
isSale: true,
+ salePercent: 10,
+ originalPrice: 10900,
},
{
id: 6,
diff --git a/client/src/types/item.ts b/client/src/types/item.ts
index 85bce3f..36d9336 100644
--- a/client/src/types/item.ts
+++ b/client/src/types/item.ts
@@ -7,4 +7,6 @@ export interface IItem {
isGreen?: boolean;
isNew?: boolean;
isSale?: boolean;
+ salePercent?: number;
+ originalPrice?: number;
}
From b905579b39d77857b18762a2ed82dffcfae5a703 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 01:27:21 +0900
Subject: [PATCH 023/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EC=83=81=EC=84=B8=20=ED=8E=98?=
=?UTF-8?q?=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 3 ++-
client/src/components/item/index.tsx | 17 ++++++++++++++---
client/src/components/item/item-list.tsx | 4 ++++
client/src/pages/index.ts | 1 +
client/src/pages/item-detail-page.tsx | 23 +++++++++++++++++++++++
5 files changed, 44 insertions(+), 4 deletions(-)
create mode 100644 client/src/pages/item-detail-page.tsx
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 27b00a7..80a7d08 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { BrowserRouter, Switch, Route } from 'lib/router';
-import { MainPage, NotFoundPage, LoginPage, SignupPage } from 'pages';
+import { MainPage, NotFoundPage, LoginPage, SignupPage, ItemDetailPage } from 'pages';
import Theme from './styles/theme';
const App: React.FC = () => {
@@ -11,6 +11,7 @@ const App: React.FC = () => {
+
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index e48b374..a38f1f0 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -1,4 +1,4 @@
-import React, { FC, useState } from 'react';
+import React, { FC, useState, MouseEvent } from 'react';
import styled from 'styled-components';
import { formatPrice } from 'utils';
import likeIcon from 'assets/icons/like.png';
@@ -18,6 +18,7 @@ interface ItemProps {
isSale?: boolean;
salePercent?: number;
originalPrice?: number;
+ onClick: () => void;
}
interface ContainerProps {
@@ -201,13 +202,19 @@ const Item: FC = ({
isSale,
salePercent,
originalPrice,
+ onClick,
}) => {
const [isLiked, setIsLiked] = useState(false);
const toggleLike = () => setIsLiked(!isLiked);
+ const onItemClick = (e: MouseEvent) => {
+ if ((e.target as HTMLDivElement).classList.contains('like')) return;
+ onClick();
+ };
+
return (
-
+
@@ -225,7 +232,11 @@ const Item: FC = ({
{isSale && }
- {isLiked ? : }
+ {isLiked ? (
+
+ ) : (
+
+ )}
);
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index edb6083..95dbd5c 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -1,5 +1,6 @@
import React, { FC } from 'react';
import styled from 'styled-components';
+import { useHistory } from 'lib/router';
import { IItem } from 'types/item';
import Item from 'components/item';
@@ -27,6 +28,8 @@ const Wrapper = styled.div`
`;
const ItemList: FC = ({ items }) => {
+ const history = useHistory();
+
return (
{items.map(item => {
@@ -42,6 +45,7 @@ const ItemList: FC = ({ items }) => {
isSale={item.isSale}
salePercent={item.salePercent}
originalPrice={item.originalPrice}
+ onClick={() => history.push(`/item/${item.id}`)}
/>
);
})}
diff --git a/client/src/pages/index.ts b/client/src/pages/index.ts
index b54abf9..3f114d1 100644
--- a/client/src/pages/index.ts
+++ b/client/src/pages/index.ts
@@ -2,3 +2,4 @@ export { default as NotFoundPage } from './not-found-page';
export { default as MainPage } from './main-page';
export { default as LoginPage } from './login-page';
export { default as SignupPage } from './signup-page';
+export { default as ItemDetailPage } from './item-detail-page';
diff --git a/client/src/pages/item-detail-page.tsx b/client/src/pages/item-detail-page.tsx
new file mode 100644
index 0000000..f19f9bd
--- /dev/null
+++ b/client/src/pages/item-detail-page.tsx
@@ -0,0 +1,23 @@
+import React, { ReactElement } from 'react';
+import useWindowSize from 'hooks/use-window-size';
+import SmartMenuContainer from 'containers/smart-menu-container';
+import HeaderContainer from 'containers/header-container';
+import { Layout, Footer } from 'components';
+
+const MainPage = (): ReactElement => {
+ const { width } = useWindowSize();
+ const isMobile = width <= 480;
+
+ return (
+
+
+
+
+ 여기는 아이템 디테일 페이지
+
+
+
+ );
+};
+
+export default MainPage;
From 2aea214f2bd82769c3c3dd83bfaec2990f4e68d9 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 01:35:58 +0900
Subject: [PATCH 024/163] =?UTF-8?q?fix:=20eslint=20=ED=8C=8C=EC=9D=BC=20?=
=?UTF-8?q?=EC=98=A4=EB=A5=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/.eslintrc.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/client/.eslintrc.json b/client/.eslintrc.json
index 17f4e3c..3c0ee2e 100644
--- a/client/.eslintrc.json
+++ b/client/.eslintrc.json
@@ -17,6 +17,7 @@
"react/prop-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"import/no-unresolved": "off",
+ "import/prefer-default-export": "off",
"@typescript-eslint/no-shadow": "off",
"no-param-reassign": ["error", { "props": true, "ignorePropertyModificationsFor": ["state"] }]
},
From b0c5d78bfd834957a52d4e4ffb60ed06314b25e1 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 10:43:34 +0900
Subject: [PATCH 025/163] =?UTF-8?q?refactor:=20goDetailPage=20=ED=95=A8?=
=?UTF-8?q?=EC=88=98=20=EB=B6=84=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/item-list.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index 95dbd5c..231b098 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -30,6 +30,10 @@ const Wrapper = styled.div`
const ItemList: FC = ({ items }) => {
const history = useHistory();
+ const goDetailPage = (id: number) => {
+ history.push(`/item/${id}`);
+ };
+
return (
{items.map(item => {
@@ -45,7 +49,7 @@ const ItemList: FC = ({ items }) => {
isSale={item.isSale}
salePercent={item.salePercent}
originalPrice={item.originalPrice}
- onClick={() => history.push(`/item/${item.id}`)}
+ onClick={() => goDetailPage(item.id)}
/>
);
})}
From 17d2cad4a9cecef8406f7b8bc6fd1a085ec7deac Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 11:16:36 +0900
Subject: [PATCH 026/163] chore: styled-component -> woowahan-component
migration
---
client/src/components/item/index.tsx | 40 ++++++++++------------
client/src/components/item/item-list.tsx | 6 ++--
client/src/components/smart-menu/index.tsx | 4 +--
3 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index a38f1f0..95524cd 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -1,5 +1,5 @@
import React, { FC, useState, MouseEvent } from 'react';
-import styled from 'styled-components';
+import styled from 'lib/woowahan-components';
import { formatPrice } from 'utils';
import likeIcon from 'assets/icons/like.png';
import likeFilledIcon from 'assets/icons/like-filled.png';
@@ -21,31 +21,27 @@ interface ItemProps {
onClick: () => void;
}
-interface ContainerProps {
- bgColor?: 'red' | 'beige' | 'green';
-}
-
-const Container = styled.div`
+const Container = styled.div`
cursor: pointer;
width: 230px;
height: 380px;
padding: 5px;
background-color: ${props => {
- if (props.bgColor === 'red') return props.theme.colorPointRed;
- if (props.bgColor === 'beige') return props.theme.colorPointBeige;
- return props.theme.colorPointDarkGreen;
+ if (props.bgColor === 'red') return props.theme?.colorPointRed;
+ if (props.bgColor === 'beige') return props.theme?.colorPointBeige;
+ return props.theme?.colorPointDarkGreen;
}};
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
width: 150px;
height: 280px;
}
- ${props => props.theme.tablet} {
+ ${props => props.theme?.tablet} {
width: 180px;
height: 320px;
}
@@ -77,11 +73,11 @@ const Thumbnail = styled.div`
object-fit: cover;
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
height: 220px;
}
- ${props => props.theme.tablet} {
+ ${props => props.theme?.tablet} {
height: 250px;
}
`;
@@ -89,8 +85,8 @@ const Thumbnail = styled.div`
const Info = styled.div`
margin-left: 2px;
margin-bottom: 6px;
- font-family: ${props => props.theme.fontEuljiro};
- color: ${props => props.theme.colorOffWhite};
+ font-family: ${props => props.theme?.fontEuljiro};
+ color: ${props => props.theme?.colorOffWhite};
.title {
width: 220px;
@@ -107,12 +103,12 @@ const Info = styled.div`
span {
font-size: 22px;
- color: ${props => props.theme.colorGreyMid};
+ color: ${props => props.theme?.colorGreyMid};
text-decoration: line-through;
}
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
.title {
width: 140px;
font-size: 14px;
@@ -127,7 +123,7 @@ const Info = styled.div`
}
}
- ${props => props.theme.tablet} {
+ ${props => props.theme?.tablet} {
.title {
width: 170px;
font-size: 16px;
@@ -150,11 +146,11 @@ const SaleWrapper = styled.div`
span {
font-size: 24px;
- font-family: ${props => props.theme.fontEuljiro};
- color: ${props => props.theme.colorWhite};
+ font-family: ${props => props.theme?.fontEuljiro};
+ color: ${props => props.theme?.colorWhite};
}
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
top: 217px;
span {
@@ -162,7 +158,7 @@ const SaleWrapper = styled.div`
}
}
- ${props => props.theme.tablet} {
+ ${props => props.theme?.tablet} {
top: 247px;
span {
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index 231b098..980e07d 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import styled from 'styled-components';
+import styled from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IItem } from 'types/item';
import Item from 'components/item';
@@ -18,11 +18,11 @@ const Wrapper = styled.div`
grid-gap: 10px 16px;
justify-content: center;
- ${props => props.theme.mobile} {
+ ${props => props.theme?.mobile} {
grid-template-columns: repeat(auto-fit, 150px);
}
- ${props => props.theme.tablet} {
+ ${props => props.theme?.tablet} {
grid-template-columns: repeat(auto-fit, 180px);
}
`;
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index fda93e2..9328c80 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -24,8 +24,8 @@ const MenuDiv = woowahan.div`
background-color: ${({ theme }) => theme?.colorBg};
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
- color: ${({ theme }) => theme.colorBlack};
- border: 3px solid ${({ theme }) => theme.colorLineDark};
+ color: ${({ theme }) => theme?.colorBlack};
+ border: 3px solid ${({ theme }) => theme?.colorLineDark};
z-index: 1000;
`;
From 6db5c8ca526d2284af61ebd379d34767f41f5d37 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 11:25:41 +0900
Subject: [PATCH 027/163] =?UTF-8?q?refactor:=20goDetailPage=20=ED=95=A8?=
=?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/item-list.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index 980e07d..1a344f1 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -30,7 +30,7 @@ const Wrapper = styled.div`
const ItemList: FC = ({ items }) => {
const history = useHistory();
- const goDetailPage = (id: number) => {
+ const goDetailPage = (id: number) => () => {
history.push(`/item/${id}`);
};
@@ -49,7 +49,7 @@ const ItemList: FC = ({ items }) => {
isSale={item.isSale}
salePercent={item.salePercent}
originalPrice={item.originalPrice}
- onClick={() => goDetailPage(item.id)}
+ onClick={goDetailPage(item.id)}
/>
);
})}
From 24206e032619cd3a0f06d490f56f600864f59aa6 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Wed, 18 Aug 2021 02:56:31 +0900
Subject: [PATCH 028/163] =?UTF-8?q?wip:=20=EC=95=84=EC=9D=B4=EB=94=94=20?=
=?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20length=20=EB=B3=80?=
=?UTF-8?q?=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/auth/form.tsx | 4 ++--
server/src/config/constants.ts | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/client/src/components/auth/form.tsx b/client/src/components/auth/form.tsx
index cf81804..df74f69 100644
--- a/client/src/components/auth/form.tsx
+++ b/client/src/components/auth/form.tsx
@@ -118,14 +118,14 @@ const AuthForm: FC = ({
- 팩스번호 : 050-605-0041 | 메일 : baemin_store@woowahan.com | 배민문방구 인스타그램 : @baemin_store
+ 팩스번호 : 050-605-0041 | 메일 : baemin_store@styled.com | 배민문방구 인스타그램 : @baemin_store
주소 : 서울특별시 송파구 위례성대로 2 장은빌딩 | 호스팅제공 : AWS
© Men of the geurim Corp. All right Reserved
diff --git a/client/src/components/common/header.tsx b/client/src/components/common/header.tsx
index f6f1858..7103616 100644
--- a/client/src/components/common/header.tsx
+++ b/client/src/components/common/header.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { Link } from 'lib/router';
import { Logo, Navbar } from 'components';
import BrickBg from 'assets/images/brick.png';
@@ -12,11 +12,11 @@ interface HeaderProps {
onLogout: () => void;
}
-const Wrapper = woowahan.header`
+const Wrapper = styled.header`
width: 100%;
`;
-const Brick = woowahan.div`
+const Brick = styled.div`
width: 100%;
height: 150px;
background-image: url(${BrickBg});
@@ -28,7 +28,7 @@ const Brick = woowahan.div`
}
`;
-const Tent = woowahan.div`
+const Tent = styled.div`
width: 100%;
height: 80px;
background-image: url(${TentBg});
@@ -39,7 +39,7 @@ const Tent = woowahan.div`
}
`;
-const LogoWrapper = woowahan.div`
+const LogoWrapper = styled.div`
display: flex;
justify-content: center;
padding: 25px 0;
diff --git a/client/src/components/common/layout.tsx b/client/src/components/common/layout.tsx
index ceafc9e..141cbce 100644
--- a/client/src/components/common/layout.tsx
+++ b/client/src/components/common/layout.tsx
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
-const Wrapper = woowahan.div`
+const Wrapper = styled.div`
min-height: 100%;
background-color: ${props => props.theme?.colorBg};
display: flex;
diff --git a/client/src/components/common/logo.tsx b/client/src/components/common/logo.tsx
index 1f62210..59c0611 100644
--- a/client/src/components/common/logo.tsx
+++ b/client/src/components/common/logo.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import LogoImg from 'assets/images/logo.png';
import LogoTentImg from 'assets/images/logo_tent.png';
@@ -12,7 +12,7 @@ interface LogoProps {
mobile?: boolean;
}
-const Wrapper = woowahan.div`
+const Wrapper = styled.div`
width: fit-content;
`;
diff --git a/client/src/components/common/modal.tsx b/client/src/components/common/modal.tsx
index dc8eb5f..21f207c 100644
--- a/client/src/components/common/modal.tsx
+++ b/client/src/components/common/modal.tsx
@@ -1,5 +1,5 @@
import React, { FC, ReactNode } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import alertImg from 'assets/icons/congrats.gif';
import confirmImg from 'assets/icons/wait.png';
@@ -12,7 +12,7 @@ interface ModalProps {
onConfirm?: () => void;
}
-const ModalBlock = woowahan.div`
+const ModalBlock = styled.div`
position: fixed;
left: 0;
top: 0;
@@ -26,7 +26,7 @@ const ModalBlock = woowahan.div`
z-index: 10;
`;
-const Inner = woowahan.div`
+const Inner = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
@@ -52,7 +52,7 @@ const Inner = woowahan.div`
}
`;
-const ModalHeader = woowahan.div`
+const ModalHeader = styled.div`
display: flex;
flex-direction: column;
align-items: center;
@@ -82,7 +82,7 @@ const ModalHeader = woowahan.div`
}
`;
-const ModalBody = woowahan.div`
+const ModalBody = styled.div`
text-align: center;
margin-bottom: 20px;
@@ -101,7 +101,7 @@ const ModalBody = woowahan.div`
}
`;
-const ModalFooter = woowahan.div`
+const ModalFooter = styled.div`
margin-top: 10px;
button {
diff --git a/client/src/components/common/navbar.tsx b/client/src/components/common/navbar.tsx
index 077ad88..e7cc15d 100644
--- a/client/src/components/common/navbar.tsx
+++ b/client/src/components/common/navbar.tsx
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import { Link } from 'lib/router';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { Logo } from 'components';
import accountIcon from 'assets/icons/account.png';
@@ -15,7 +15,7 @@ interface NavbarProps {
onLogout: () => void;
}
-const Wrapper = woowahan.nav`
+const Wrapper = styled.nav`
background-color: ${props => (props.white ? props.theme?.colorWhite : props.theme?.colorBg)};
border-bottom: 1px solid ${props => props.theme?.colorLineLight};
padding: 10px 10%;
diff --git a/client/src/components/form/button.tsx b/client/src/components/form/button.tsx
index 0676b66..fbb8699 100644
--- a/client/src/components/form/button.tsx
+++ b/client/src/components/form/button.tsx
@@ -1,6 +1,6 @@
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
-const Button = woowahan.button`
+const Button = styled.button`
cursor: pointer;
border: 0;
display: flex;
diff --git a/client/src/components/form/input.tsx b/client/src/components/form/input.tsx
index 1112a50..3b33f33 100644
--- a/client/src/components/form/input.tsx
+++ b/client/src/components/form/input.tsx
@@ -1,6 +1,6 @@
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
-const Input = woowahan.input`
+const Input = styled.input`
border: 0;
border-bottom: 2px solid ${props => props.theme?.colorGreyMid};
color: ${props => props.theme?.colorSoftBlack};
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index 9328c80..64f98bd 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,5 +1,5 @@
import React, { useState, FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import { IMenu } from 'types/category';
import { SMART_MENU_LARGE_WIDTH, SMART_MENU_SMALL_WIDTH, SMART_MENU_BLOCK_DELAY } from '../../constants';
@@ -12,7 +12,7 @@ interface SmartMenuProps {
menu: IMenu;
}
-const MenuDiv = woowahan.div`
+const MenuDiv = styled.div`
cursor: pointer;
position: fixed;
top: 200px;
@@ -29,7 +29,7 @@ const MenuDiv = woowahan.div`
z-index: 1000;
`;
-const MenuTitle = woowahan.div`
+const MenuTitle = styled.div`
padding-left: 20px;
color: ${({ theme }) => theme?.colorLineDark};
font-family: ${({ theme }) => theme?.fontHanna};
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index 4bc0847..3d00b1a 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { IMenu } from 'types/category';
import { SMART_MENU_BLOCK_DELAY } from '../../constants';
@@ -17,7 +17,7 @@ interface LargeMenuProps {
>;
}
-const LargeItemDiv = woowahan.ul`
+const LargeItemDiv = styled.ul`
writing-mode: horizontal-tb;
text-orientation: sideways;
background-color: ${({ theme }) => theme?.colorBg};
@@ -25,7 +25,7 @@ const LargeItemDiv = woowahan.ul`
padding-left: 32px;
`;
-const LargeItem = woowahan.li`
+const LargeItem = styled.li`
font-family: ${({ theme }) => theme?.fontHannaAir};
display: flex;
background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index 170007c..8e71e2e 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { IMenu } from 'types/category';
interface MediumMenuProps {
@@ -9,11 +9,11 @@ interface MediumMenuProps {
setMediumId: React.Dispatch>;
}
-const MediumItemDiv = woowahan.div`
+const MediumItemDiv = styled.div`
display: flex;
`;
-const MediumItem = woowahan.ul`
+const MediumItem = styled.ul`
font-family: ${({ theme }) => theme?.fontHannaAir};
writing-mode: horizontal-tb;
text-orientation: sideways;
diff --git a/client/src/components/smart-menu/small-menu.tsx b/client/src/components/smart-menu/small-menu.tsx
index 9990743..053d3f5 100644
--- a/client/src/components/smart-menu/small-menu.tsx
+++ b/client/src/components/smart-menu/small-menu.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { IMenu } from 'types/category';
interface SmallMenuProps {
@@ -8,12 +8,12 @@ interface SmallMenuProps {
selectedMediumId: string;
}
-const SmallItemDiv = woowahan.div`
+const SmallItemDiv = styled.div`
writing-mode: horizontal-tb;
text-orientation: sideways;
`;
-const SmallItem = woowahan.div`
+const SmallItem = styled.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
font-size: 26px;
background-color: ${({ theme }) => theme?.colorBg};
diff --git a/client/src/lib/woowahan-components/index.ts b/client/src/lib/woowahan-components/index.ts
index 22b44dd..7fd24d6 100644
--- a/client/src/lib/woowahan-components/index.ts
+++ b/client/src/lib/woowahan-components/index.ts
@@ -8,10 +8,10 @@ export interface IWoowahan {
[key: string]: TaggedTemplateType;
}
-const woowahan: IWoowahan = {};
+const styled: IWoowahan = {};
tags.forEach((tag: string) => {
- woowahan[tag] = woowahanComponent(tag);
+ styled[tag] = woowahanComponent(tag);
});
-export default woowahan;
+export default styled;
diff --git a/client/src/pages/not-found-page.tsx b/client/src/pages/not-found-page.tsx
index 20b44da..deb77cf 100644
--- a/client/src/pages/not-found-page.tsx
+++ b/client/src/pages/not-found-page.tsx
@@ -1,10 +1,10 @@
import React, { ReactElement } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-const Text = woowahan.div`
+const Text = styled.div`
flex: 1;
display: flex;
flex-direction: column;
diff --git a/client/src/pages/signup-page.tsx b/client/src/pages/signup-page.tsx
index cc73b8b..6ba2f72 100644
--- a/client/src/pages/signup-page.tsx
+++ b/client/src/pages/signup-page.tsx
@@ -1,11 +1,11 @@
import React, { ReactElement } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import SignupContainer from 'containers/signup-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-const Div = woowahan.div`
+const Div = styled.div`
display: flex;
flex-direction: column;
align-items: center;
From 46b6f306cf1c4dbbef9039e27db88eb429761c0d Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 21:42:30 +0900
Subject: [PATCH 068/163] =?UTF-8?q?fix:=20interface=20=EC=83=81=EB=8B=A8?=
=?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../search-bar/recent-keyword-box.tsx | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/client/src/components/search-bar/recent-keyword-box.tsx b/client/src/components/search-bar/recent-keyword-box.tsx
index 051197b..9c0c14d 100644
--- a/client/src/components/search-bar/recent-keyword-box.tsx
+++ b/client/src/components/search-bar/recent-keyword-box.tsx
@@ -3,6 +3,15 @@ import styled from 'lib/woowahan-components';
import xIcon from 'assets/icons/x.png';
+interface RecentKeywordBoxProps {
+ keywords: string[];
+ isOpen: boolean;
+ isRecent: boolean;
+ setInput: (keyword: string) => void;
+ removeRecentKeyword: (index: number) => void;
+ moveToSearchPage: (keyword: string) => void;
+}
+
const Container = styled.ul`
position: absolute;
padding: 4px;
@@ -38,15 +47,6 @@ const KeywordList = styled.li`
}
`;
-interface RecentKeywordBoxProps {
- keywords: string[];
- isOpen: boolean;
- isRecent: boolean;
- setInput: (keyword: string) => void;
- removeRecentKeyword: (index: number) => void;
- moveToSearchPage: (keyword: string) => void;
-}
-
const RecentKeywordBox: FC = ({
keywords,
isOpen,
From 783b6d706e7c41afb4831558321843171d799f70 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 21:42:42 +0900
Subject: [PATCH 069/163] =?UTF-8?q?fix:=20redux=20=EC=97=90=EB=9F=AC=20?=
=?UTF-8?q?=EC=B2=98=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/item.ts | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/client/src/store/item.ts b/client/src/store/item.ts
index 616b38b..c8cbb14 100644
--- a/client/src/store/item.ts
+++ b/client/src/store/item.ts
@@ -1,5 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
-import axios, { AxiosResponse } from 'axios';
+import { AxiosResponse } from 'axios';
import { call, put, takeLatest } from 'redux-saga/effects';
import { startLoading, finishLoading } from 'store/loading';
@@ -52,13 +52,9 @@ function* autoCompleteSaga(action: PayloadAction): Generator {
)) as AxiosResponse;
yield put({ type: getAutoCompleteSuccess.type, payload: data });
} catch (e) {
- if (axios.isAxiosError(e)) {
- yield put({
- type: getAutoCompleteFail.type,
- });
- } else {
- throw new Error(e);
- }
+ yield put({
+ type: getAutoCompleteFail.type,
+ });
} finally {
yield put(finishLoading(getAutoComplete.type));
}
From 56cfc281f9471fd89e65243912912d9bc435369a Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 21:57:41 +0900
Subject: [PATCH 070/163] =?UTF-8?q?fix:=20=3F=20=EC=99=9C=20=EB=B0=94?=
=?UTF-8?q?=EB=80=9C=3F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/common/footer.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/common/footer.tsx b/client/src/components/common/footer.tsx
index 8ac3f25..0ccd2cd 100644
--- a/client/src/components/common/footer.tsx
+++ b/client/src/components/common/footer.tsx
@@ -141,7 +141,7 @@ const Footer: FC = ({ isMobile }) => {
상호 : (주)그림의남자들 | 대표 : 윤민상 | 사업자등록번호 : 120-87-65763 | 통신판매업신고번호 :
2012-서울송파-0515
- 팩스번호 : 050-605-0041 | 메일 : baemin_store@styled.com | 배민문방구 인스타그램 : @baemin_store
+ 팩스번호 : 050-605-0041 | 메일 : baemin_store@woowahan.com | 배민문방구 인스타그램 : @baemin_store
주소 : 서울특별시 송파구 위례성대로 2 장은빌딩 | 호스팅제공 : AWS
© Men of the geurim Corp. All right Reserved
From 416ef060d82fca33f9c910234fc42340991c159c Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:40:52 +0900
Subject: [PATCH 071/163] =?UTF-8?q?wip:=20items=20api=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/utils/api/items.ts | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 client/src/utils/api/items.ts
diff --git a/client/src/utils/api/items.ts b/client/src/utils/api/items.ts
new file mode 100644
index 0000000..77c6a4f
--- /dev/null
+++ b/client/src/utils/api/items.ts
@@ -0,0 +1,4 @@
+import { AxiosResponse } from 'axios';
+import client from './client';
+
+export const getMainItems = (): Promise => client.get('/api/items/main');
From 245ecaf3ecb5945baabe85f02bc7c6f55fa100e0 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:41:09 +0900
Subject: [PATCH 072/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=8A=A4=ED=86=A0=EC=96=B4=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/items.ts | 55 +++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 client/src/store/items.ts
diff --git a/client/src/store/items.ts b/client/src/store/items.ts
new file mode 100644
index 0000000..ef1fd59
--- /dev/null
+++ b/client/src/store/items.ts
@@ -0,0 +1,55 @@
+import { createSlice, PayloadAction } from '@reduxjs/toolkit';
+import { takeLatest } from 'redux-saga/effects';
+import * as itemsAPI from 'utils/api/items';
+import { IItem } from 'types/item';
+import createPromiseSaga from 'utils/saga-utils';
+
+interface MainProps {
+ popularItems: IItem[] | null;
+ newItems: IItem[] | null;
+ recommendItems: IItem[] | null;
+}
+
+interface StateProps {
+ mainItems: {
+ popularItems: IItem[] | null;
+ newItems: IItem[] | null;
+ recommendItems: IItem[] | null;
+ };
+ items: IItem[] | null;
+ error: null | string;
+}
+
+const initialState: StateProps = {
+ mainItems: {
+ popularItems: null,
+ newItems: null,
+ recommendItems: null,
+ },
+ items: null,
+ error: null,
+};
+
+const counterSlice = createSlice({
+ name: 'item',
+ initialState,
+ reducers: {
+ getMainItems: state => state,
+ getMainItemsSuccess: (state, action: PayloadAction) => {
+ state.mainItems = action.payload as unknown as MainProps;
+ },
+ getMainItemsFail: (state, action: PayloadAction) => {
+ state.error = action.payload;
+ return state;
+ },
+ },
+});
+
+const { actions, reducer: itemsReducer } = counterSlice;
+const { getMainItems } = actions;
+export { getMainItems, itemsReducer };
+const getMainItemsSaga = createPromiseSaga(getMainItems.type, itemsAPI.getMainItems);
+
+export function* itemsSaga(): Generator {
+ yield takeLatest(getMainItems, getMainItemsSaga);
+}
From 6f2e2c76de158b3233a02622d7b2e77db1aa7d54 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:41:43 +0900
Subject: [PATCH 073/163] =?UTF-8?q?wip:=20ui=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/common/layout.tsx | 1 +
client/src/pages/login-page.tsx | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/client/src/components/common/layout.tsx b/client/src/components/common/layout.tsx
index 6bf74b2..cd19638 100644
--- a/client/src/components/common/layout.tsx
+++ b/client/src/components/common/layout.tsx
@@ -13,6 +13,7 @@ const Wrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
+ justify-content: center;
}
${props => props.theme?.mobile} {
diff --git a/client/src/pages/login-page.tsx b/client/src/pages/login-page.tsx
index bc92944..5399a66 100644
--- a/client/src/pages/login-page.tsx
+++ b/client/src/pages/login-page.tsx
@@ -1,9 +1,17 @@
import React, { ReactElement } from 'react';
+import woowahan from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import LoginContainer from 'containers/login-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
+const Div = woowahan.div`
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin: 10px 0;
+`;
+
const LoginPage = (): ReactElement => {
const { width } = useWindowSize();
const isMobile = width <= 480;
@@ -12,7 +20,9 @@ const LoginPage = (): ReactElement => {
-
+
+
+
From ce4bac235427ebe9d25849faaa1f951bb126db84 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:42:12 +0900
Subject: [PATCH 074/163] =?UTF-8?q?wip:=20=EB=A6=AC=EB=8D=95=EC=8A=A4=20?=
=?UTF-8?q?=EB=B0=94=EB=80=90=EC=A0=90=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/index.ts | 6 +++---
client/src/store/loading.ts | 7 ++++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/client/src/store/index.ts b/client/src/store/index.ts
index 7df1796..962f93f 100644
--- a/client/src/store/index.ts
+++ b/client/src/store/index.ts
@@ -1,16 +1,16 @@
import { combineReducers } from 'redux';
import { all } from 'redux-saga/effects';
import { authReducer, authSaga } from './auth';
+import { itemsReducer, itemsSaga } from './items';
import { loadingReducer } from './loading';
-import { itemReducer, itemSaga } from './item';
-const rootReducer = combineReducers({ auth: authReducer, loading: loadingReducer, item: itemReducer });
+const rootReducer = combineReducers({ auth: authReducer, loading: loadingReducer, items: itemsReducer });
export type RootState = ReturnType;
export function* rootSaga(): Generator {
try {
- yield all([authSaga(), itemSaga()]);
+ yield all([authSaga(), itemsSaga()]);
} catch (e) {
throw new Error(e);
}
diff --git a/client/src/store/loading.ts b/client/src/store/loading.ts
index e71c6b0..61fe9f5 100644
--- a/client/src/store/loading.ts
+++ b/client/src/store/loading.ts
@@ -2,7 +2,12 @@ import { createSlice } from '@reduxjs/toolkit';
const loadingSlice = createSlice({
name: 'loading',
- initialState: { 'auth/getLogin': false, 'auth/getUser': false, 'auth/getSignup': false },
+ initialState: {
+ 'auth/getLogin': false,
+ 'auth/getUser': false,
+ 'auth/getSignup': false,
+ 'auth/getMainItemSuccess': false,
+ },
reducers: {
startLoading: (state, action) => ({ ...state, [action.payload]: true }),
finishLoading: (state, action) => ({ ...state, [action.payload]: false }),
From 83e02db5bcf54dee72dcf5478fa3e5cacf05e2f5 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:42:36 +0900
Subject: [PATCH 075/163] =?UTF-8?q?wip:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/pages/main-page.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/pages/main-page.tsx b/client/src/pages/main-page.tsx
index 3ae5cc3..5121840 100644
--- a/client/src/pages/main-page.tsx
+++ b/client/src/pages/main-page.tsx
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
import useWindowSize from 'hooks/use-window-size';
import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
-import ItemContainer from 'containers/item-container';
+import MainItemContainer from 'containers/main-item-container';
import { Layout, Footer } from 'components';
import SearchBar from 'containers/search-container';
@@ -16,7 +16,7 @@ const MainPage = (): ReactElement => {
-
+
From e8a0f743341c332f19d1b89315600eed62c5bc94 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:44:01 +0900
Subject: [PATCH 076/163] =?UTF-8?q?wip:=20=EB=94=94=EC=8A=A4=ED=8C=A8?=
=?UTF-8?q?=EC=B9=98=20type=20=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/signup-container.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/containers/signup-container.tsx b/client/src/containers/signup-container.tsx
index ec76ca6..32b47e1 100644
--- a/client/src/containers/signup-container.tsx
+++ b/client/src/containers/signup-container.tsx
@@ -25,7 +25,7 @@ const SignupContainer: FC = () => {
useEffect(() => {
return () => {
- dispatch({ type: getSignupReset });
+ dispatch({ type: getSignupReset.type });
};
}, [dispatch]);
From 9f1c1a86ac2e7ca5c948c90b74650c65db671f31 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:44:27 +0900
Subject: [PATCH 077/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88=20?=
=?UTF-8?q?=EC=9E=91=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 기능 x ui x
---
client/src/containers/main-item-container.tsx | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 client/src/containers/main-item-container.tsx
diff --git a/client/src/containers/main-item-container.tsx b/client/src/containers/main-item-container.tsx
new file mode 100644
index 0000000..09a0b3e
--- /dev/null
+++ b/client/src/containers/main-item-container.tsx
@@ -0,0 +1,32 @@
+import React, { FC, useEffect } from 'react';
+import ItemList from 'components/item/item-list';
+import { useDispatch, useSelector } from 'react-redux';
+import { RootState } from 'store';
+import { getMainItems } from 'store/items';
+
+const MainItemContainer: FC = () => {
+ const { popularItems, newItems, recommendItems, loading } = useSelector(({ items, loading }: RootState) => ({
+ popularItems: items.mainItems.popularItems,
+ newItems: items.mainItems.newItems,
+ recommendItems: items.mainItems.recommendItems,
+ loading: loading['auth/getMainItemSuccess'],
+ }));
+ const dispatch = useDispatch();
+ useEffect(() => {
+ dispatch({ type: getMainItems.type });
+ }, [dispatch]);
+ return (
+ <>
+ 잘나가요
+
+ 새로 나왔어요
+
+ 추천 드려요
+
+ >
+ );
+ // 로딩을 위에서나 전체 레이아웃같은데다가 줘도 될듯
+ // return ;
+};
+
+export default MainItemContainer;
From 148feb9bea032b278a74f6068d4ca38046930283 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 03:44:59 +0900
Subject: [PATCH 078/163] =?UTF-8?q?wip:=20=EB=A6=AC=EC=8A=A4=ED=8A=B8?=
=?UTF-8?q?=EA=B0=80=20=EC=A1=B4=EC=9E=AC=ED=95=98=EC=A7=80=20=EC=95=8A?=
=?UTF-8?q?=EC=9D=84=EB=95=8C=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EC=A7=80=20?=
=?UTF-8?q?=EC=95=8A=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/item-list.tsx | 37 +++++-----
client/src/containers/item-container.tsx | 86 ------------------------
2 files changed, 19 insertions(+), 104 deletions(-)
delete mode 100644 client/src/containers/item-container.tsx
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index f127053..ec667f2 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -5,7 +5,7 @@ import { IItem } from 'types/item';
import Item from 'components/item';
interface ItemListProps {
- items: IItem[];
+ items: IItem[] | null;
isLoading: boolean;
}
@@ -34,23 +34,24 @@ const ItemList: FC = ({ items }) => {
return (
- {items.map(item => {
- return (
-
- );
- })}
+ {items &&
+ items.map(item => {
+ return (
+
+ );
+ })}
);
};
diff --git a/client/src/containers/item-container.tsx b/client/src/containers/item-container.tsx
deleted file mode 100644
index 5d705da..0000000
--- a/client/src/containers/item-container.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import React, { FC } from 'react';
-import ItemList from 'components/item/item-list';
-import { IItem } from 'types/item';
-
-const ITEM_DUMMY: IItem[] = [
- {
- id: 1,
- thumbnail:
- 'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
- title: '맥주짠 세트',
- price: 9810,
- isSale: true,
- salePercent: 10,
- originalPrice: 10900,
- },
- {
- id: 2,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
- title: 'ㅋㅋ슬리퍼 블랙',
- price: 21000,
- isBest: true,
- },
- {
- id: 3,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
- title: '커피찌꺼기를 재활용해 만든 연필',
- price: 2500,
- isGreen: true,
- isNew: true,
- },
- {
- id: 4,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
- title: '반반휴지. 물반휴지반',
- price: 1500,
- isBest: true,
- },
- {
- id: 5,
- thumbnail:
- 'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
- title: '맥주짠 세트',
- price: 9810,
- isSale: true,
- salePercent: 10,
- originalPrice: 10900,
- },
- {
- id: 6,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
- title: 'ㅋㅋ슬리퍼 블랙',
- price: 21000,
- },
- {
- id: 7,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
- title: '커피찌꺼기를 재활용해 만든 연필',
- price: 2500,
- },
- {
- id: 8,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20210423/1917382/1917382_1_500.jpg',
- title: '반반휴지. 물반휴지반',
- price: 1500,
- },
- {
- id: 9,
- thumbnail:
- 'https://mblogthumb-phinf.pstatic.net/MjAxODA1MDJfMTk3/MDAxNTI1MjM1MDI1MjM2.qcbRcEwFPkpyaAV_RQ41cmQzmVEZHJSM3fiwzUeNoecg.a9D8oTOx7Jl0MKyCHvd1TnsbRllFwuYV0lvOZTlUwQsg.JPEG.smartbaedal/image_800505831525234558336.jpg?type=w800',
- title: '맥주짠 세트',
- price: 10900,
- },
- {
- id: 10,
- thumbnail: 'https://image.msscdn.net/images/goods_img/20191211/1249258/1249258_1_500.png',
- title: 'ㅋㅋ슬리퍼 블랙',
- price: 21000,
- },
-];
-
-const ItemContainer: FC = () => {
- /* TODO: get items method - saga */
- return ;
-};
-
-export default ItemContainer;
From 2cfbab10f51eb229339e22cb9ab9c718eff1f59c Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 13:12:42 +0900
Subject: [PATCH 079/163] =?UTF-8?q?feat:=20api=20=EC=B9=B4=ED=85=8C?=
=?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=95=84=EC=9D=B4=ED=85=9C=20=EB=B6=88?=
=?UTF-8?q?=EB=9F=AC=EC=98=A4=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/utils/api/items.ts | 4 ++++
client/src/utils/saga-utils/index.ts | 31 ----------------------------
2 files changed, 4 insertions(+), 31 deletions(-)
delete mode 100644 client/src/utils/saga-utils/index.ts
diff --git a/client/src/utils/api/items.ts b/client/src/utils/api/items.ts
index 77c6a4f..747d762 100644
--- a/client/src/utils/api/items.ts
+++ b/client/src/utils/api/items.ts
@@ -1,4 +1,8 @@
import { AxiosResponse } from 'axios';
+import { IItemsState } from 'store/items';
import client from './client';
export const getMainItems = (): Promise => client.get('/api/items/main');
+
+export const getCategoryItems = ({ categoryId, pageId = 1, type }: IItemsState): Promise =>
+ client.get(`/api/items/category?categoryId=${categoryId}&pageId=${pageId}&type=${type}`);
diff --git a/client/src/utils/saga-utils/index.ts b/client/src/utils/saga-utils/index.ts
deleted file mode 100644
index ead13de..0000000
--- a/client/src/utils/saga-utils/index.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { PayloadAction } from '@reduxjs/toolkit';
-import axios, { AxiosResponse } from 'axios';
-import { call, put } from 'redux-saga/effects';
-import { startLoading, finishLoading } from 'store/loading';
-
-type IData = unknown;
-interface IError {
- errorMessage: string;
-}
-
-const createPromiseSaga = (type: string, promiseCreator: (data: unknown) => Promise): unknown => {
- const SUCCESS = `${type}Success`;
- const FAIL = `${type}Success`;
- return function* saga(action: PayloadAction) {
- try {
- yield put(startLoading(type));
- const { data } = (yield call(promiseCreator, action.payload)) as AxiosResponse;
- yield put({ type: SUCCESS, payload: data });
- } catch (e) {
- if (axios.isAxiosError(e)) {
- const { errorMessage } = e.response?.data as IError;
- yield put({ type: FAIL, payload: errorMessage });
- } else {
- throw new Error(e);
- }
- } finally {
- yield put(finishLoading(type));
- }
- };
-};
-export default createPromiseSaga;
From 34cc353980fcf844803cec7f3754a4538ab4701a Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 13:13:09 +0900
Subject: [PATCH 080/163] =?UTF-8?q?fix:=20=EC=98=A4=ED=83=80=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/loading.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/store/loading.ts b/client/src/store/loading.ts
index 61fe9f5..a52073a 100644
--- a/client/src/store/loading.ts
+++ b/client/src/store/loading.ts
@@ -6,7 +6,7 @@ const loadingSlice = createSlice({
'auth/getLogin': false,
'auth/getUser': false,
'auth/getSignup': false,
- 'auth/getMainItemSuccess': false,
+ 'auth/getMainItem': false,
},
reducers: {
startLoading: (state, action) => ({ ...state, [action.payload]: true }),
From d2b2797547f54ffae308816c4f4a8418932e9c2d Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 13:13:45 +0900
Subject: [PATCH 081/163] =?UTF-8?q?feat:=20=EB=A6=AC=EB=8D=95=EC=8A=A4?=
=?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?=
=?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=20=EB=B6=88=EB=9F=AC=EC=98=A4?=
=?UTF-8?q?=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/items.ts | 69 ++++++++++++++++++++++++++++++++++++---
1 file changed, 65 insertions(+), 4 deletions(-)
diff --git a/client/src/store/items.ts b/client/src/store/items.ts
index ef1fd59..4c1832f 100644
--- a/client/src/store/items.ts
+++ b/client/src/store/items.ts
@@ -1,8 +1,16 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
-import { takeLatest } from 'redux-saga/effects';
+import { call, takeLatest } from 'redux-saga/effects';
import * as itemsAPI from 'utils/api/items';
+import axios, { AxiosResponse } from 'axios';
import { IItem } from 'types/item';
-import createPromiseSaga from 'utils/saga-utils';
+import { put } from 'redux-saga-test-plan/matchers';
+import { finishLoading, startLoading } from './loading';
+
+export interface IItemsState {
+ categoryId: string;
+ pageId?: number;
+ type: string;
+}
interface MainProps {
popularItems: IItem[] | null;
@@ -20,6 +28,10 @@ interface StateProps {
error: null | string;
}
+interface IError {
+ errorMessage: string;
+}
+
const initialState: StateProps = {
mainItems: {
popularItems: null,
@@ -42,14 +54,63 @@ const counterSlice = createSlice({
state.error = action.payload;
return state;
},
+ getCategoryItems: state => state,
+ getCategoryItemsSuccess: (state, action: PayloadAction) => {
+ state.items = action.payload as unknown as IItem[];
+ },
+ getCategoryItemsFail: (state, action: PayloadAction) => {
+ state.error = action.payload;
+ return state;
+ },
},
});
const { actions, reducer: itemsReducer } = counterSlice;
-const { getMainItems } = actions;
+const {
+ getMainItems,
+ getMainItemsSuccess,
+ getMainItemsFail,
+ getCategoryItems,
+ getCategoryItemsSuccess,
+ getCategoryItemsFail,
+} = actions;
export { getMainItems, itemsReducer };
-const getMainItemsSaga = createPromiseSaga(getMainItems.type, itemsAPI.getMainItems);
+
+function* getMainItemsSaga(): Generator {
+ try {
+ yield put(startLoading(getMainItems.type));
+ const { data } = (yield call(itemsAPI.getMainItems)) as AxiosResponse;
+ yield put({ type: getMainItemsSuccess.type, payload: data });
+ } catch (e) {
+ if (axios.isAxiosError(e)) {
+ const { errorMessage } = e.response?.data as IError;
+ yield put({ type: getMainItemsFail.type, payload: errorMessage });
+ } else {
+ throw new Error(e);
+ }
+ } finally {
+ yield put(finishLoading(getMainItems.type));
+ }
+}
+
+function* getCategoryItemsSaga(): Generator {
+ try {
+ yield put(startLoading(getCategoryItems.type));
+ const { data } = (yield call(itemsAPI.getMainItems)) as AxiosResponse;
+ yield put({ type: getCategoryItemsSuccess.type, payload: data });
+ } catch (e) {
+ if (axios.isAxiosError(e)) {
+ const { errorMessage } = e.response?.data as IError;
+ yield put({ type: getCategoryItemsFail.type, payload: errorMessage });
+ } else {
+ throw new Error(e);
+ }
+ } finally {
+ yield put(finishLoading(getCategoryItems.type));
+ }
+}
export function* itemsSaga(): Generator {
yield takeLatest(getMainItems, getMainItemsSaga);
+ yield takeLatest(getCategoryItems, getCategoryItemsSaga);
}
From a6e3c26bdbd3cdf858dabaa9d257995cf623dc2b Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 13:15:08 +0900
Subject: [PATCH 082/163] =?UTF-8?q?wip:=20=EB=A9=94=EC=9D=B8=EC=95=84?=
=?UTF-8?q?=EC=9D=B4=ED=85=9C=20=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/main-item-container.tsx | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/client/src/containers/main-item-container.tsx b/client/src/containers/main-item-container.tsx
index 09a0b3e..bbdf70b 100644
--- a/client/src/containers/main-item-container.tsx
+++ b/client/src/containers/main-item-container.tsx
@@ -1,32 +1,23 @@
import React, { FC, useEffect } from 'react';
-import ItemList from 'components/item/item-list';
import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import { getMainItems } from 'store/items';
+import MainItems from 'components/item/main-items';
const MainItemContainer: FC = () => {
const { popularItems, newItems, recommendItems, loading } = useSelector(({ items, loading }: RootState) => ({
popularItems: items.mainItems.popularItems,
newItems: items.mainItems.newItems,
recommendItems: items.mainItems.recommendItems,
- loading: loading['auth/getMainItemSuccess'],
+ loading: loading['auth/getMainItem'],
}));
const dispatch = useDispatch();
useEffect(() => {
dispatch({ type: getMainItems.type });
}, [dispatch]);
return (
- <>
- 잘나가요
-
- 새로 나왔어요
-
- 추천 드려요
-
- >
+
);
- // 로딩을 위에서나 전체 레이아웃같은데다가 줘도 될듯
- // return ;
};
export default MainItemContainer;
From c4cb2171b9cd3ce29431abb520cbd152d56db153 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 13:15:37 +0900
Subject: [PATCH 083/163] =?UTF-8?q?feat:=20=EB=A9=94=EC=9D=B8=20=EC=95=84?=
=?UTF-8?q?=EC=9D=B4=ED=85=9C=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?=
=?UTF-8?q?=EC=9E=91=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/main-items.tsx | 52 +++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 client/src/components/item/main-items.tsx
diff --git a/client/src/components/item/main-items.tsx b/client/src/components/item/main-items.tsx
new file mode 100644
index 0000000..ac23321
--- /dev/null
+++ b/client/src/components/item/main-items.tsx
@@ -0,0 +1,52 @@
+import React, { FC, useCallback } from 'react';
+import styled from 'lib/woowahan-components';
+import { IItem } from 'types/item';
+import ItemList from 'components/item/item-list';
+
+interface ItemListProps {
+ popularItems: IItem[] | null;
+ newItems: IItem[] | null;
+ recommendItems: IItem[] | null;
+ loading: boolean;
+}
+
+const Div = styled.div`
+ margin-top: 90px;
+ ${props => props.theme?.mobile} {
+ margin-top: 50px;
+ }
+
+ ${props => props.theme?.tablet} {
+ margin-top: 70px;
+ }
+`;
+
+const SmallTitle = styled.div`
+ font-family: ${props => props.theme?.fontHanna};
+ font-size: 36px;
+ ${props => props.theme?.mobile} {
+ font-size: 20px;
+ margin-left: 50px;
+ }
+
+ ${props => props.theme?.tablet} {
+ font-size: 28px;
+ margin-left: 50px;
+ }
+`;
+
+const MainItems: FC = ({ popularItems, newItems, recommendItems, loading }) => {
+ return (
+
+ {loading &&
로딩중
}
+
잘나가요
+
+
새로 나왔어요
+
+
추천 드려요
+
+
+ );
+};
+
+export default MainItems;
From db234e2c1828d13bcf9f50937909f967fd75b1e7 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:48:37 +0900
Subject: [PATCH 084/163] =?UTF-8?q?wip:=20=EC=A3=BC=EC=84=9D=EC=A0=9C?=
=?UTF-8?q?=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/loaders/sequelize.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/server/src/loaders/sequelize.ts b/server/src/loaders/sequelize.ts
index ed0bd05..c0c15bd 100644
--- a/server/src/loaders/sequelize.ts
+++ b/server/src/loaders/sequelize.ts
@@ -4,7 +4,6 @@ import { CATEGORY_DATA } from 'config/constants';
const { User, Item, Like, Address, Category, Order, Review } = db;
export default async (): Promise => {
- // db안되면 외래키 다시보기
User.belongsToMany(Item, { through: Like });
User.hasMany(Address);
User.hasMany(Order);
From 210aff50e96b30c5668a57de67022b592fbb30d8 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:48:52 +0900
Subject: [PATCH 085/163] =?UTF-8?q?wip:=20api=20=EC=97=86=EB=8A=94=20?=
=?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/utils/api/items.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/client/src/utils/api/items.ts b/client/src/utils/api/items.ts
index 747d762..f6aa3ca 100644
--- a/client/src/utils/api/items.ts
+++ b/client/src/utils/api/items.ts
@@ -1,8 +1,9 @@
import { AxiosResponse } from 'axios';
+import { IItem } from 'types/item';
import { IItemsState } from 'store/items';
import client from './client';
export const getMainItems = (): Promise => client.get('/api/items/main');
export const getCategoryItems = ({ categoryId, pageId = 1, type }: IItemsState): Promise =>
- client.get(`/api/items/category?categoryId=${categoryId}&pageId=${pageId}&type=${type}`);
+ client.get(`/api/items/category?categoryId=${categoryId}&pageId=${pageId}&type=${type}`);
From a6ce8459d8e32daa92f4ba09b0342a4266b0b107 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:49:20 +0900
Subject: [PATCH 086/163] =?UTF-8?q?wip:=20formatPrice=20=ED=95=A8=EC=88=98?=
=?UTF-8?q?=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- string, number가 둘다 들어가는 경우가 있어서 수정
---
client/src/utils/index.ts | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/client/src/utils/index.ts b/client/src/utils/index.ts
index 841dca9..3e6ecd7 100644
--- a/client/src/utils/index.ts
+++ b/client/src/utils/index.ts
@@ -1,3 +1,4 @@
-export const formatPrice = (price: number): string => {
- return price.toLocaleString('ko-KR');
+export const formatPrice = (price: string | number): string => {
+ const parsePrice = typeof price === 'string' ? parseInt(price, 10) : price;
+ return parsePrice.toLocaleString('ko-KR');
};
From 0e7bd7ad192aebe588b001d6ee35a1b69926373e Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:51:52 +0900
Subject: [PATCH 087/163] =?UTF-8?q?wip:=20=EB=A1=9C=EB=94=A9=EC=8A=A4?=
=?UTF-8?q?=ED=86=A0=EC=96=B4=EC=97=90=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EB=A1=9C=EB=94=A9=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/loading.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/client/src/store/loading.ts b/client/src/store/loading.ts
index a52073a..730ed28 100644
--- a/client/src/store/loading.ts
+++ b/client/src/store/loading.ts
@@ -6,7 +6,8 @@ const loadingSlice = createSlice({
'auth/getLogin': false,
'auth/getUser': false,
'auth/getSignup': false,
- 'auth/getMainItem': false,
+ 'items/getMainItems': false,
+ 'items/getCategoryItems': false,
},
reducers: {
startLoading: (state, action) => ({ ...state, [action.payload]: true }),
From 94b68078f0a1f72a2ec51509dcf0a2072bca05c7 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:52:49 +0900
Subject: [PATCH 088/163] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EB=B6=88=EB=9F=AC=EC=98=A4=EB=8A=94=20=EC=8A=A4=ED=86=A0?=
=?UTF-8?q?=EC=96=B4=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/store/items.ts | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/client/src/store/items.ts b/client/src/store/items.ts
index 4c1832f..ccf5d74 100644
--- a/client/src/store/items.ts
+++ b/client/src/store/items.ts
@@ -12,7 +12,7 @@ export interface IItemsState {
type: string;
}
-interface MainProps {
+interface IMainItems {
popularItems: IItem[] | null;
newItems: IItem[] | null;
recommendItems: IItem[] | null;
@@ -43,12 +43,12 @@ const initialState: StateProps = {
};
const counterSlice = createSlice({
- name: 'item',
+ name: 'items',
initialState,
reducers: {
getMainItems: state => state,
getMainItemsSuccess: (state, action: PayloadAction) => {
- state.mainItems = action.payload as unknown as MainProps;
+ state.mainItems = action.payload as unknown as IMainItems;
},
getMainItemsFail: (state, action: PayloadAction) => {
state.error = action.payload;
@@ -74,12 +74,12 @@ const {
getCategoryItemsSuccess,
getCategoryItemsFail,
} = actions;
-export { getMainItems, itemsReducer };
+export { getMainItems, getCategoryItems, itemsReducer };
function* getMainItemsSaga(): Generator {
try {
yield put(startLoading(getMainItems.type));
- const { data } = (yield call(itemsAPI.getMainItems)) as AxiosResponse;
+ const { data } = (yield call(itemsAPI.getMainItems)) as AxiosResponse;
yield put({ type: getMainItemsSuccess.type, payload: data });
} catch (e) {
if (axios.isAxiosError(e)) {
@@ -93,10 +93,12 @@ function* getMainItemsSaga(): Generator {
}
}
-function* getCategoryItemsSaga(): Generator {
+function* getCategoryItemsSaga(action: PayloadAction): Generator {
try {
yield put(startLoading(getCategoryItems.type));
- const { data } = (yield call(itemsAPI.getMainItems)) as AxiosResponse;
+ const { data } = (yield call(itemsAPI.getCategoryItems, action.payload as unknown as IItemsState)) as AxiosResponse<
+ IItem[]
+ >;
yield put({ type: getCategoryItemsSuccess.type, payload: data });
} catch (e) {
if (axios.isAxiosError(e)) {
From 22dbe8368980b5ee2e57df3df62ed0372fb09abf Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:53:03 +0900
Subject: [PATCH 089/163] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/types/item.ts | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/client/src/types/item.ts b/client/src/types/item.ts
index 36d9336..1b82665 100644
--- a/client/src/types/item.ts
+++ b/client/src/types/item.ts
@@ -2,11 +2,10 @@ export interface IItem {
id: number;
thumbnail: string;
title: string;
- price: number;
+ price: string;
isBest?: boolean;
- isGreen?: boolean;
+ isGreen: boolean;
isNew?: boolean;
- isSale?: boolean;
- salePercent?: number;
+ salePercent: number;
originalPrice?: number;
}
From a783302ee448098780f223e27c0cb24fa6a3192b Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:53:32 +0900
Subject: [PATCH 090/163] =?UTF-8?q?chore:=20=EA=B0=81=EC=A2=85=20=EC=9E=A1?=
=?UTF-8?q?=EB=8B=A4=ED=95=9C=20=EC=9D=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 14 ++++++--------
client/src/components/item/item-list.tsx | 2 --
client/src/components/item/main-items.tsx | 2 +-
client/src/containers/main-item-container.tsx | 2 +-
4 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index 95524cd..fad3534 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -11,11 +11,10 @@ import badgeSaleIcon from 'assets/icons/badge_sale.png';
interface ItemProps {
thumbnail: string;
title: string;
- price: number;
+ price: string;
isBest?: boolean;
- isGreen?: boolean;
+ isGreen: boolean;
isNew?: boolean;
- isSale?: boolean;
salePercent?: number;
originalPrice?: number;
onClick: () => void;
@@ -195,7 +194,6 @@ const Item: FC = ({
isBest,
isGreen,
isNew,
- isSale,
salePercent,
originalPrice,
onClick,
@@ -210,22 +208,22 @@ const Item: FC = ({
};
return (
-
+
{title}
- {formatPrice(price)}원 {isSale && originalPrice && {formatPrice(originalPrice)}원}
+ {formatPrice(price)}원 {salePercent && originalPrice && {formatPrice(originalPrice)}원}
- {isSale && salePercent && {salePercent}%}
+ {salePercent && salePercent && {salePercent}%}
{isBest && }
{isGreen && }
{isNew && }
- {isSale && }
+ {salePercent && }
{isLiked ? (
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index ec667f2..0bdd4e5 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -29,7 +29,6 @@ const Wrapper = styled.div`
const ItemList: FC = ({ items }) => {
const history = useHistory();
-
const goDetailPage = useCallback((id: number) => () => history.push(`/item/${id}`), [history]);
return (
@@ -45,7 +44,6 @@ const ItemList: FC = ({ items }) => {
isBest={item.isBest}
isGreen={item.isGreen}
isNew={item.isNew}
- isSale={item.isSale}
salePercent={item.salePercent}
originalPrice={item.originalPrice}
onClick={goDetailPage(item.id)}
diff --git a/client/src/components/item/main-items.tsx b/client/src/components/item/main-items.tsx
index ac23321..f732e52 100644
--- a/client/src/components/item/main-items.tsx
+++ b/client/src/components/item/main-items.tsx
@@ -1,4 +1,4 @@
-import React, { FC, useCallback } from 'react';
+import React, { FC } from 'react';
import styled from 'lib/woowahan-components';
import { IItem } from 'types/item';
import ItemList from 'components/item/item-list';
diff --git a/client/src/containers/main-item-container.tsx b/client/src/containers/main-item-container.tsx
index bbdf70b..a8836ef 100644
--- a/client/src/containers/main-item-container.tsx
+++ b/client/src/containers/main-item-container.tsx
@@ -9,7 +9,7 @@ const MainItemContainer: FC = () => {
popularItems: items.mainItems.popularItems,
newItems: items.mainItems.newItems,
recommendItems: items.mainItems.recommendItems,
- loading: loading['auth/getMainItem'],
+ loading: loading['items/getMainItems'],
}));
const dispatch = useDispatch();
useEffect(() => {
From e73587f9678558d9130162351c556cec0b9608fe Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:53:48 +0900
Subject: [PATCH 091/163] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/pages/category-page.tsx | 24 ++++++++++++++++++++++++
client/src/pages/index.ts | 1 +
2 files changed, 25 insertions(+)
create mode 100644 client/src/pages/category-page.tsx
diff --git a/client/src/pages/category-page.tsx b/client/src/pages/category-page.tsx
new file mode 100644
index 0000000..dbce697
--- /dev/null
+++ b/client/src/pages/category-page.tsx
@@ -0,0 +1,24 @@
+import React, { ReactElement } from 'react';
+import useWindowSize from 'hooks/use-window-size';
+import SmartMenuContainer from 'containers/smart-menu-container';
+import HeaderContainer from 'containers/header-container';
+import { Layout, Footer } from 'components';
+import CategoryItemContainer from 'containers/category-container';
+
+const CategoryPage = (): ReactElement => {
+ const { width } = useWindowSize();
+ const isMobile = width <= 480;
+
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+export default CategoryPage;
diff --git a/client/src/pages/index.ts b/client/src/pages/index.ts
index 629f0f3..79502e0 100644
--- a/client/src/pages/index.ts
+++ b/client/src/pages/index.ts
@@ -4,3 +4,4 @@ export { default as LoginPage } from './login-page';
export { default as SignupPage } from './signup-page';
export { default as ItemDetailPage } from './item-detail-page';
export { default as AuthPage } from './auth-page';
+export { default as CategoryPage } from './category-page';
From 449a3fef22f07b1baac63235164f958243170346 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:54:19 +0900
Subject: [PATCH 092/163] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=BB=A8=ED=85=8C?=
=?UTF-8?q?=EC=9D=B4=EB=84=88=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/category-container.tsx | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 client/src/containers/category-container.tsx
diff --git a/client/src/containers/category-container.tsx b/client/src/containers/category-container.tsx
new file mode 100644
index 0000000..cc2a997
--- /dev/null
+++ b/client/src/containers/category-container.tsx
@@ -0,0 +1,20 @@
+import React, { FC, useEffect } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+import { RootState } from 'store';
+import CategoryItems from 'components/item/category-items';
+import { getCategoryItems } from 'store/items';
+
+const CategoryItemContainer: FC = () => {
+ const { items, loading } = useSelector(({ items, loading }: RootState) => ({
+ items: items.items,
+ loading: loading['items/getCategoryItems'],
+ }));
+ const dispatch = useDispatch();
+ const [categoryId, pageId, type] = ['080000', 1, 'recent'];
+ useEffect(() => {
+ dispatch({ type: getCategoryItems.type, payload: { categoryId, pageId, type } });
+ }, [dispatch, categoryId, pageId, type]);
+ return ;
+};
+
+export default CategoryItemContainer;
From 2cf81319dab3608632cc2619bf767da45ef70915 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 16:54:45 +0900
Subject: [PATCH 093/163] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=BB=B4=ED=8F=AC?=
=?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 3 +-
client/src/components/item/category-items.tsx | 46 +++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 client/src/components/item/category-items.tsx
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 66fd3b0..602c2f1 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter, Switch, Route } from 'lib/router';
-import { MainPage, NotFoundPage, LoginPage, SignupPage, AuthPage, ItemDetailPage } from 'pages';
+import { MainPage, NotFoundPage, LoginPage, SignupPage, AuthPage, ItemDetailPage, CategoryPage } from 'pages';
import Theme from './styles/theme';
const App: React.FC = () => {
@@ -13,6 +13,7 @@ const App: React.FC = () => {
+
diff --git a/client/src/components/item/category-items.tsx b/client/src/components/item/category-items.tsx
new file mode 100644
index 0000000..d72850c
--- /dev/null
+++ b/client/src/components/item/category-items.tsx
@@ -0,0 +1,46 @@
+import React, { FC } from 'react';
+import styled from 'lib/woowahan-components';
+import { IItem } from 'types/item';
+import ItemList from 'components/item/item-list';
+
+interface ItemListProps {
+ items: IItem[] | null;
+ loading: boolean;
+}
+
+const Div = styled.div`
+ margin-top: 90px;
+ ${props => props.theme?.mobile} {
+ margin-top: 50px;
+ }
+
+ ${props => props.theme?.tablet} {
+ margin-top: 70px;
+ }
+`;
+
+const SmallTitle = styled.div`
+ font-family: ${props => props.theme?.fontHanna};
+ font-size: 36px;
+ ${props => props.theme?.mobile} {
+ font-size: 20px;
+ margin-left: 50px;
+ }
+
+ ${props => props.theme?.tablet} {
+ font-size: 28px;
+ margin-left: 50px;
+ }
+`;
+
+const CategoryItems: FC = ({ items, loading }) => {
+ return (
+
+ {loading &&
로딩중
}
+
총 개수, 추천 등등...
+
+
+ );
+};
+
+export default CategoryItems;
From 4e503dd5948b13f1c585930ff6fa780da7a6b961 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 17:04:33 +0900
Subject: [PATCH 094/163] =?UTF-8?q?fix:=20db=20=EB=B0=9B=EC=95=84=EC=98=AC?=
=?UTF-8?q?=EB=95=8C=20=EC=BB=AC=EB=9F=BC=EB=AA=85=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/repositories/items.ts | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/server/src/repositories/items.ts b/server/src/repositories/items.ts
index a36dfb8..67269dc 100644
--- a/server/src/repositories/items.ts
+++ b/server/src/repositories/items.ts
@@ -10,7 +10,15 @@ const getMainItems = async (
limit: number,
): Promise[]> => {
const items = await db.Item.findAll({
- attributes: ['id', 'title', 'thumbnail', 'contents', 'price', 'sale_percent', 'amount', 'is_green'],
+ attributes: [
+ 'id',
+ 'title',
+ 'thumbnail',
+ 'price',
+ ['sale_percent', 'salePercent'],
+ 'amount',
+ ['is_green', 'isGreen'],
+ ],
order: order as Order,
limit,
raw: true,
@@ -32,7 +40,15 @@ const getCategoryItems = async (
categoryReg: string,
): Promise[]> => {
const items = await db.Item.findAll({
- attributes: ['id', 'title', 'thumbnail', 'contents', 'price', 'sale_percent', 'amount', 'is_green'],
+ attributes: [
+ 'id',
+ 'title',
+ 'thumbnail',
+ 'price',
+ ['sale_percent', 'salePercent'],
+ 'amount',
+ ['is_green', 'isGreen'],
+ ],
order: order as Order,
where: { CategoryId: { [Op.regexp]: `^${categoryReg}` } },
offset: (pageId - 1) * 8 + 1,
From 97283c48628d00513874ead1176a1db3873607f6 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 18:46:43 +0900
Subject: [PATCH 095/163] =?UTF-8?q?feat:=20usequery=20=ED=95=A8=EC=88=98?=
=?UTF-8?q?=20=EB=A7=8C=EB=93=A4=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/category-container.tsx | 3 ++-
server/src/services/items.ts | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/containers/category-container.tsx b/client/src/containers/category-container.tsx
index cc2a997..8ff903d 100644
--- a/client/src/containers/category-container.tsx
+++ b/client/src/containers/category-container.tsx
@@ -3,6 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import CategoryItems from 'components/item/category-items';
import { getCategoryItems } from 'store/items';
+import { useQuery } from 'utils';
const CategoryItemContainer: FC = () => {
const { items, loading } = useSelector(({ items, loading }: RootState) => ({
@@ -10,7 +11,7 @@ const CategoryItemContainer: FC = () => {
loading: loading['items/getCategoryItems'],
}));
const dispatch = useDispatch();
- const [categoryId, pageId, type] = ['080000', 1, 'recent'];
+ const { categoryId, pageId, type } = useQuery();
useEffect(() => {
dispatch({ type: getCategoryItems.type, payload: { categoryId, pageId, type } });
}, [dispatch, categoryId, pageId, type]);
diff --git a/server/src/services/items.ts b/server/src/services/items.ts
index 0188c16..0949102 100644
--- a/server/src/services/items.ts
+++ b/server/src/services/items.ts
@@ -18,7 +18,6 @@ async function categoryItems(
pageId = 1,
type: string,
): Promise[]> {
- console.log(categoryId, pageId, type);
if (
!(
categoryId ||
From d160afa5596b47d7b546542bba98a1c706c6d4f6 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 18:47:17 +0900
Subject: [PATCH 096/163] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=ED=85=9C=20an?=
=?UTF-8?q?d=20=EC=97=B0=EC=82=B0=EC=9E=90=EC=97=90=20=EC=88=AB=EC=9E=90?=
=?UTF-8?q?=20=EB=82=98=EC=98=A4=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 5 ++---
client/src/utils/index.ts | 14 ++++++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index fad3534..e80bd95 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -206,7 +206,6 @@ const Item: FC = ({
if ((e.target as HTMLDivElement).classList.contains('like')) return;
onClick();
};
-
return (
@@ -218,12 +217,12 @@ const Item: FC = ({
{formatPrice(price)}원 {salePercent && originalPrice && {formatPrice(originalPrice)}원}
- {salePercent && salePercent && {salePercent}%}
+ {salePercent !== 0 && {salePercent}%}
{isBest && }
{isGreen && }
{isNew && }
- {salePercent && }
+ {salePercent !== 0 && }
{isLiked ? (
diff --git a/client/src/utils/index.ts b/client/src/utils/index.ts
index 3e6ecd7..477544f 100644
--- a/client/src/utils/index.ts
+++ b/client/src/utils/index.ts
@@ -1,3 +1,17 @@
+interface IQuery {
+ [key: string]: string;
+}
+
+export const useQuery = (): IQuery => {
+ const { search } = window.location;
+ const params: IQuery = {};
+ search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (str: string, key: string, value: string): string => {
+ params[key] = value;
+ return '';
+ });
+ return params;
+};
+
export const formatPrice = (price: string | number): string => {
const parsePrice = typeof price === 'string' ? parseInt(price, 10) : price;
return parsePrice.toLocaleString('ko-KR');
From 15c5e634f1d1137cd3bdabfa7080f7c157787409 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 19:54:56 +0900
Subject: [PATCH 097/163] =?UTF-8?q?wip:=20=EC=84=9C=EB=B2=84=EC=97=90?=
=?UTF-8?q?=EC=84=9C=20tinyint=EB=A5=BC=20boolean=EC=9C=BC=EB=A1=9C=20?=
=?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/models/item.ts | 5 +++--
server/src/repositories/items.ts | 10 ++++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/server/src/models/item.ts b/server/src/models/item.ts
index b8e975e..22ee46a 100644
--- a/server/src/models/item.ts
+++ b/server/src/models/item.ts
@@ -6,10 +6,11 @@ export interface ItemAttributes {
thumbnail: string;
contents: string;
price: string;
- sale_percent: number;
+ sale_percent: number | boolean;
sale_count: number;
amount: number;
- is_green: number;
+ is_green: number | boolean;
+ isGreen?: number | boolean;
CategoryId: string;
}
diff --git a/server/src/repositories/items.ts b/server/src/repositories/items.ts
index 67269dc..e7aa262 100644
--- a/server/src/repositories/items.ts
+++ b/server/src/repositories/items.ts
@@ -21,7 +21,6 @@ const getMainItems = async (
],
order: order as Order,
limit,
- raw: true,
});
if (!items) {
@@ -31,6 +30,10 @@ const getMainItems = async (
});
}
+ items.forEach(v => {
+ v.setDataValue('isGreen', v.getDataValue('isGreen') === 1);
+ });
+
return items;
};
@@ -53,7 +56,6 @@ const getCategoryItems = async (
where: { CategoryId: { [Op.regexp]: `^${categoryReg}` } },
offset: (pageId - 1) * 8 + 1,
limit: 12,
- raw: true,
include: [
{
model: db.Category,
@@ -69,6 +71,10 @@ const getCategoryItems = async (
});
}
+ items.forEach(v => {
+ v.setDataValue('isGreen', v.getDataValue('isGreen') === 1);
+ });
+
return items;
};
From b30444ae0dbf1f2aa7e5ebd1e57a6b5b5f14d61f Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 20:55:50 +0900
Subject: [PATCH 098/163] =?UTF-8?q?wip:=20=ED=95=84=EC=9A=94=EC=97=86?=
=?UTF-8?q?=EB=8A=94=20try=20catch=20=EC=A0=9C=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/index.tsx | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/client/src/index.tsx b/client/src/index.tsx
index 3b6aa32..7faf6c4 100644
--- a/client/src/index.tsx
+++ b/client/src/index.tsx
@@ -20,14 +20,10 @@ const store = configureStore({
sagaMiddleware.run(rootSaga);
function loadUser() {
- try {
- const user = localStorage.getItem('user');
- if (!user) return;
-
- store.dispatch({ type: getUser.type });
- } catch (e) {
- throw new Error(e);
- }
+ const user = localStorage.getItem('user');
+ if (!user) return;
+
+ store.dispatch({ type: getUser.type });
}
loadUser();
From 29e1910a80bbeff81664efcb8c1460391c86ee46 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 20:56:22 +0900
Subject: [PATCH 099/163] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EA=B0=80=EA=B2=A9=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/item/index.tsx b/client/src/components/item/index.tsx
index e80bd95..fae79fd 100644
--- a/client/src/components/item/index.tsx
+++ b/client/src/components/item/index.tsx
@@ -214,7 +214,7 @@ const Item: FC = ({
{title}
- {formatPrice(price)}원 {salePercent && originalPrice && {formatPrice(originalPrice)}원}
+ {formatPrice(price)}원 {salePercent !== 0 && originalPrice && {formatPrice(originalPrice)}원}
{salePercent !== 0 && {salePercent}%}
From 2a828c76c417ba04cdf70107a4064447939cccad Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 22:19:13 +0900
Subject: [PATCH 100/163] =?UTF-8?q?wip:=20=EC=B6=A9=EB=8F=8C=ED=95=B4?=
=?UTF-8?q?=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/common/layout.tsx | 2 --
client/src/store/index.ts | 10 ++++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/client/src/components/common/layout.tsx b/client/src/components/common/layout.tsx
index cd19638..a4c9d7c 100644
--- a/client/src/components/common/layout.tsx
+++ b/client/src/components/common/layout.tsx
@@ -12,8 +12,6 @@ const Wrapper = styled.div`
padding: 0 10%;
display: flex;
flex-direction: column;
- align-items: center;
- justify-content: center;
}
${props => props.theme?.mobile} {
diff --git a/client/src/store/index.ts b/client/src/store/index.ts
index 962f93f..f16f08e 100644
--- a/client/src/store/index.ts
+++ b/client/src/store/index.ts
@@ -1,16 +1,22 @@
import { combineReducers } from 'redux';
import { all } from 'redux-saga/effects';
import { authReducer, authSaga } from './auth';
+import { itemReducer, itemSaga } from './item';
import { itemsReducer, itemsSaga } from './items';
import { loadingReducer } from './loading';
-const rootReducer = combineReducers({ auth: authReducer, loading: loadingReducer, items: itemsReducer });
+const rootReducer = combineReducers({
+ auth: authReducer,
+ loading: loadingReducer,
+ items: itemsReducer,
+ item: itemReducer,
+});
export type RootState = ReturnType;
export function* rootSaga(): Generator {
try {
- yield all([authSaga(), itemsSaga()]);
+ yield all([authSaga(), itemsSaga(), itemSaga()]);
} catch (e) {
throw new Error(e);
}
From 06ac242c9b29b78b085f6137cdcddda3b82d5f48 Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 22:31:28 +0900
Subject: [PATCH 101/163] =?UTF-8?q?chore:=20=EC=B6=A9=EB=8F=8C=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/index.tsx | 10 +++++
client/src/store/category.ts | 67 ++++++++++++++++++++++++++++++++
client/src/store/index.ts | 4 +-
client/src/utils/api/category.ts | 4 ++
4 files changed, 84 insertions(+), 1 deletion(-)
create mode 100644 client/src/store/category.ts
create mode 100644 client/src/utils/api/category.ts
diff --git a/client/src/index.tsx b/client/src/index.tsx
index 7faf6c4..0ad91eb 100644
--- a/client/src/index.tsx
+++ b/client/src/index.tsx
@@ -4,6 +4,7 @@ import createSagaMiddleware from 'redux-saga';
import { Provider } from 'react-redux';
import { configureStore } from '@reduxjs/toolkit';
import { getUser } from 'store/auth';
+import { getCategories } from 'store/category';
import logger from 'redux-logger';
import rootReducer, { rootSaga } from './store';
import App from './App';
@@ -26,7 +27,16 @@ function loadUser() {
store.dispatch({ type: getUser.type });
}
+function loadCategories() {
+ try {
+ store.dispatch({ type: getCategories.type });
+ } catch (e) {
+ throw new Error(e);
+ }
+}
+
loadUser();
+loadCategories();
ReactDOM.render(
diff --git a/client/src/store/category.ts b/client/src/store/category.ts
new file mode 100644
index 0000000..4bc7a8f
--- /dev/null
+++ b/client/src/store/category.ts
@@ -0,0 +1,67 @@
+import { createSlice, PayloadAction } from '@reduxjs/toolkit';
+import axios, { AxiosResponse } from 'axios';
+import { call, put, takeLatest } from 'redux-saga/effects';
+import * as categoryAPI from 'utils/api/category';
+import { ICategory } from 'types/category';
+
+interface StateProps {
+ categories: {
+ data: ICategory[];
+ error: null | string;
+ };
+}
+
+interface IError {
+ errorMessage: string;
+}
+
+const initialState: StateProps = {
+ categories: {
+ data: [],
+ error: null,
+ },
+};
+
+const categorySlice = createSlice({
+ name: 'category',
+ initialState,
+ reducers: {
+ getCategories: state => state,
+ getCategoriesSuccess: (state, action: PayloadAction) => {
+ state.categories.data = action.payload;
+ return state;
+ },
+ getCategoriesFail: (state, action: PayloadAction) => {
+ state.categories.error = action.payload;
+ return state;
+ },
+ },
+});
+
+const { actions, reducer: categoryReducer } = categorySlice;
+const { getCategories, getCategoriesSuccess, getCategoriesFail } = actions;
+export { categoryReducer, getCategories };
+
+function* getCategorySaga(): Generator {
+ try {
+ const { data } = (yield call(categoryAPI.getCategories)) as AxiosResponse;
+ yield put({
+ type: getCategoriesSuccess.type,
+ payload: data,
+ });
+ } catch (e) {
+ if (axios.isAxiosError(e)) {
+ const { errorMessage } = e.response?.data as IError;
+ yield put({
+ type: getCategoriesFail.type,
+ payload: errorMessage,
+ });
+ } else {
+ throw new Error(e);
+ }
+ }
+}
+
+export function* categorySaga(): Generator {
+ yield takeLatest(getCategories, getCategorySaga);
+}
diff --git a/client/src/store/index.ts b/client/src/store/index.ts
index f16f08e..ebbcbce 100644
--- a/client/src/store/index.ts
+++ b/client/src/store/index.ts
@@ -4,19 +4,21 @@ import { authReducer, authSaga } from './auth';
import { itemReducer, itemSaga } from './item';
import { itemsReducer, itemsSaga } from './items';
import { loadingReducer } from './loading';
+import { categoryReducer, categorySaga } from './category';
const rootReducer = combineReducers({
auth: authReducer,
loading: loadingReducer,
items: itemsReducer,
item: itemReducer,
+ category: categoryReducer,
});
export type RootState = ReturnType;
export function* rootSaga(): Generator {
try {
- yield all([authSaga(), itemsSaga(), itemSaga()]);
+ yield all([authSaga(), itemsSaga(), itemSaga(), categorySaga()]);
} catch (e) {
throw new Error(e);
}
diff --git a/client/src/utils/api/category.ts b/client/src/utils/api/category.ts
new file mode 100644
index 0000000..7cd4d47
--- /dev/null
+++ b/client/src/utils/api/category.ts
@@ -0,0 +1,4 @@
+import { AxiosResponse } from 'axios';
+import client from './client';
+
+export const getCategories = (): Promise => client.get('/api/categories');
From 2e3a55cbda6a4d7eab19fd22ff25fdde27a3c0e1 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 16:28:43 +0900
Subject: [PATCH 102/163] =?UTF-8?q?refactor:=20auth=20store=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
오타 발견
---
client/src/store/auth.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/store/auth.ts b/client/src/store/auth.ts
index 109a5c1..ea6966f 100644
--- a/client/src/store/auth.ts
+++ b/client/src/store/auth.ts
@@ -63,7 +63,7 @@ const initialState: StateProps = {
},
};
-const counterSlice = createSlice({
+const authSlice = createSlice({
name: 'auth',
initialState,
reducers: {
@@ -117,7 +117,7 @@ const counterSlice = createSlice({
},
});
-const { actions, reducer: authReducer } = counterSlice;
+const { actions, reducer: authReducer } = authSlice;
const {
getLogin,
getLoginSuccess,
From 6c186337f6003782cf73aa2ac49d56ceff075170 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 16:52:01 +0900
Subject: [PATCH 103/163] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B6=88=EB=9F=AC?=
=?UTF-8?q?=EC=98=A4=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/containers/smart-menu-container.tsx | 64 +++++--------------
client/src/index.tsx | 6 +-
client/src/store/category.ts | 22 ++-----
3 files changed, 23 insertions(+), 69 deletions(-)
diff --git a/client/src/containers/smart-menu-container.tsx b/client/src/containers/smart-menu-container.tsx
index fe3235c..e74627d 100644
--- a/client/src/containers/smart-menu-container.tsx
+++ b/client/src/containers/smart-menu-container.tsx
@@ -1,77 +1,47 @@
import React, { FC } from 'react';
import SmartMenu from 'components/smart-menu';
import { IMenu, IMenuChild, ICategory } from 'types/category';
+import { useSelector } from 'react-redux';
+import { RootState } from 'store';
interface SmartMenuContainerProps {
currentMenu: string;
}
-/* TODO: 카테고리 더미 데이터 api 연동 후 삭제 */
-const data = [
- { name: '전체', code: '000000' },
- { name: '문구', code: '080000' },
- { name: '노트/메모지', code: '080100' },
- { name: '베이직 노트', code: '080101' },
- { name: '스프링 노트', code: '080102' },
- { name: '스프링 노트2', code: '080103' },
- { name: '스프링 노트3', code: '080104' },
- { name: '스프링 노트4', code: '080105' },
- { name: '데코레이션', code: '080200' },
- { name: '데코레이션2', code: '080300' },
- { name: '데코레이션3', code: '080400' },
- { name: '데코레이션4', code: '080500' },
- { name: '카드/편지/봉투', code: '080600' },
- { name: '스탬프', code: '080201' },
- { name: '스티커', code: '080202' },
- { name: '리빙', code: '090000' },
- { name: '데코레이션', code: '090100' },
- { name: 'ㅋㅋ에디션', code: '110000' },
- { name: 'ㅋㅋ에디션', code: '110100' },
- { name: '콜라보레이션', code: '120000' },
- { name: '콜라보레이션', code: '120100' },
- { name: '배달이친구들', code: '130000' },
- { name: '배달이친구들', code: '130100' },
- { name: '책', code: '140000' },
- { name: '책', code: '140100' },
- { name: '선물세트', code: '160000' },
- { name: '선물세트', code: '160100' },
- { name: '을지로 에디션', code: '180000' },
- { name: '을지로 에디션', code: '180100' },
- { name: '배민그린', code: '190000' },
- { name: '배민그린', code: '190100' },
-];
-
-const generateMenu = () => {
+const generateMenu = (data: ICategory[]) => {
const dataJson = { data: [] } as IMenu;
let idx = -1;
- data.forEach(row2 => {
- const row = JSON.parse(JSON.stringify(row2)) as ICategory;
- const mediumCode: string = row.code.slice(2, 4);
+ data.forEach(row => {
+ const category = JSON.parse(JSON.stringify(row)) as ICategory;
+ const mediumCode: string = category.code.slice(2, 4);
- if (row.code.indexOf('0000') >= 0) {
- dataJson.data.push(row);
+ if (category.code.indexOf('0000') >= 0) {
+ dataJson.data.push(category);
idx += 1;
- } else if (row.code.lastIndexOf('00') === 4) {
+ } else if (category.code.lastIndexOf('00') === 4) {
if (dataJson.data[idx].child === undefined) {
- dataJson.data[idx].child = [row];
+ dataJson.data[idx].child = [category];
} else {
- dataJson.data[idx].child?.push(row);
+ dataJson.data[idx].child?.push(category);
}
}
if (dataJson.data[idx].child?.[Number(mediumCode) - 1].child === undefined) {
if (dataJson.data[idx]?.child) {
- (dataJson.data[idx].child as Array)[Number(mediumCode) - 1].child = [row];
+ (dataJson.data[idx].child as Array)[Number(mediumCode) - 1].child = [category];
}
} else {
- dataJson.data[idx].child?.[Number(mediumCode) - 1].child?.push(row);
+ dataJson.data[idx].child?.[Number(mediumCode) - 1].child?.push(category);
}
});
return dataJson;
};
const SmartMenuContainer: FC = ({ currentMenu }) => {
- return ;
+ const { data } = useSelector(({ category }: RootState) => ({
+ data: category.categories.data,
+ }));
+ return ;
};
export default SmartMenuContainer;
diff --git a/client/src/index.tsx b/client/src/index.tsx
index 0ad91eb..beadcb6 100644
--- a/client/src/index.tsx
+++ b/client/src/index.tsx
@@ -28,11 +28,7 @@ function loadUser() {
}
function loadCategories() {
- try {
- store.dispatch({ type: getCategories.type });
- } catch (e) {
- throw new Error(e);
- }
+ store.dispatch({ type: getCategories.type });
}
loadUser();
diff --git a/client/src/store/category.ts b/client/src/store/category.ts
index 4bc7a8f..9350079 100644
--- a/client/src/store/category.ts
+++ b/client/src/store/category.ts
@@ -7,18 +7,12 @@ import { ICategory } from 'types/category';
interface StateProps {
categories: {
data: ICategory[];
- error: null | string;
};
}
-interface IError {
- errorMessage: string;
-}
-
const initialState: StateProps = {
categories: {
data: [],
- error: null,
},
};
@@ -31,8 +25,8 @@ const categorySlice = createSlice({
state.categories.data = action.payload;
return state;
},
- getCategoriesFail: (state, action: PayloadAction) => {
- state.categories.error = action.payload;
+ getCategoriesFail: state => {
+ state.categories.data = [];
return state;
},
},
@@ -50,15 +44,9 @@ function* getCategorySaga(): Generator {
payload: data,
});
} catch (e) {
- if (axios.isAxiosError(e)) {
- const { errorMessage } = e.response?.data as IError;
- yield put({
- type: getCategoriesFail.type,
- payload: errorMessage,
- });
- } else {
- throw new Error(e);
- }
+ yield put({
+ type: getCategoriesFail.type,
+ });
}
}
From b0bacd5b6455ce151ee9396e4d4116abd8772afb Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 17:28:25 +0900
Subject: [PATCH 104/163] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=9A=94=EC=B2=AD=20?=
=?UTF-8?q?=EC=8B=A4=ED=8C=A8=20=EC=8B=9C=20=EC=9E=AC=EC=9A=94=EC=B2=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
사가 retry 함수를 통해 카테고리 데이터 재요청
---
client/src/store/category.ts | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/client/src/store/category.ts b/client/src/store/category.ts
index 9350079..ae4c681 100644
--- a/client/src/store/category.ts
+++ b/client/src/store/category.ts
@@ -1,9 +1,12 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
-import axios, { AxiosResponse } from 'axios';
-import { call, put, takeLatest } from 'redux-saga/effects';
+import { AxiosResponse } from 'axios';
+import { retry, put, takeLatest } from 'redux-saga/effects';
import * as categoryAPI from 'utils/api/category';
import { ICategory } from 'types/category';
+const MAX_TRY_COUNT = 10;
+const DELAY_TIME = 1000;
+
interface StateProps {
categories: {
data: ICategory[];
@@ -38,7 +41,7 @@ export { categoryReducer, getCategories };
function* getCategorySaga(): Generator {
try {
- const { data } = (yield call(categoryAPI.getCategories)) as AxiosResponse;
+ const { data } = (yield retry(MAX_TRY_COUNT, DELAY_TIME, categoryAPI.getCategories)) as AxiosResponse;
yield put({
type: getCategoriesSuccess.type,
payload: data,
From 86a76fe97647c32175df9c2ef07528a27ac756f5 Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 22:33:05 +0900
Subject: [PATCH 105/163] =?UTF-8?q?chore:=20=EC=B6=A9=EB=8F=8C=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 14 +++++++++--
.../smart-menu/__test__/smart-menu.test.tsx | 4 +--
.../src/containers/smart-menu-container.tsx | 8 +++---
client/src/pages/index.ts | 1 +
client/src/pages/item-detail-page.tsx | 6 ++---
client/src/pages/item-list-page.tsx | 25 +++++++++++++++++++
client/src/pages/main-page.tsx | 2 +-
7 files changed, 49 insertions(+), 11 deletions(-)
create mode 100644 client/src/pages/item-list-page.tsx
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 602c2f1..6658790 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,7 +1,16 @@
import React from 'react';
import { BrowserRouter, Switch, Route } from 'lib/router';
-import { MainPage, NotFoundPage, LoginPage, SignupPage, AuthPage, ItemDetailPage, CategoryPage } from 'pages';
+import {
+ MainPage,
+ NotFoundPage,
+ LoginPage,
+ SignupPage,
+ AuthPage,
+ ItemDetailPage,
+ ItemListPage,
+ CategoryPage,
+} from 'pages';
import Theme from './styles/theme';
const App: React.FC = () => {
@@ -12,8 +21,9 @@ const App: React.FC = () => {
-
+
+
diff --git a/client/src/components/smart-menu/__test__/smart-menu.test.tsx b/client/src/components/smart-menu/__test__/smart-menu.test.tsx
index cfcc071..257a455 100644
--- a/client/src/components/smart-menu/__test__/smart-menu.test.tsx
+++ b/client/src/components/smart-menu/__test__/smart-menu.test.tsx
@@ -4,13 +4,13 @@ import SmartMenuContainer from '../../../containers/smart-menu-container';
describe('', () => {
it('render menu', () => {
- render();
+ render();
const menu = screen.getByText('캇테고리');
expect(menu).toBeInTheDocument();
});
it('open/close menu', () => {
- render();
+ render();
const menu = screen.getByText('캇테고리');
fireEvent.click(menu);
diff --git a/client/src/containers/smart-menu-container.tsx b/client/src/containers/smart-menu-container.tsx
index e74627d..82ed5ac 100644
--- a/client/src/containers/smart-menu-container.tsx
+++ b/client/src/containers/smart-menu-container.tsx
@@ -5,7 +5,7 @@ import { useSelector } from 'react-redux';
import { RootState } from 'store';
interface SmartMenuContainerProps {
- currentMenu: string;
+ currentCode?: string;
}
const generateMenu = (data: ICategory[]) => {
@@ -37,11 +37,13 @@ const generateMenu = (data: ICategory[]) => {
return dataJson;
};
-const SmartMenuContainer: FC = ({ currentMenu }) => {
+const SmartMenuContainer: FC = ({ currentCode }) => {
const { data } = useSelector(({ category }: RootState) => ({
data: category.categories.data,
}));
- return ;
+ const currentName = currentCode ? data.find(category => category.code === currentCode)?.name : '캇테고리';
+ console.log(currentCode, currentName);
+ return ;
};
export default SmartMenuContainer;
diff --git a/client/src/pages/index.ts b/client/src/pages/index.ts
index 79502e0..5a48155 100644
--- a/client/src/pages/index.ts
+++ b/client/src/pages/index.ts
@@ -3,5 +3,6 @@ export { default as MainPage } from './main-page';
export { default as LoginPage } from './login-page';
export { default as SignupPage } from './signup-page';
export { default as ItemDetailPage } from './item-detail-page';
+export { default as ItemListPage } from './item-list-page';
export { default as AuthPage } from './auth-page';
export { default as CategoryPage } from './category-page';
diff --git a/client/src/pages/item-detail-page.tsx b/client/src/pages/item-detail-page.tsx
index f19f9bd..c641908 100644
--- a/client/src/pages/item-detail-page.tsx
+++ b/client/src/pages/item-detail-page.tsx
@@ -4,7 +4,7 @@ import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-const MainPage = (): ReactElement => {
+const ItemDetailPage = (): ReactElement => {
const { width } = useWindowSize();
const isMobile = width <= 480;
@@ -12,7 +12,7 @@ const MainPage = (): ReactElement => {
-
+
여기는 아이템 디테일 페이지
@@ -20,4 +20,4 @@ const MainPage = (): ReactElement => {
);
};
-export default MainPage;
+export default ItemDetailPage;
diff --git a/client/src/pages/item-list-page.tsx b/client/src/pages/item-list-page.tsx
new file mode 100644
index 0000000..2da0060
--- /dev/null
+++ b/client/src/pages/item-list-page.tsx
@@ -0,0 +1,25 @@
+import React, { ReactElement } from 'react';
+import useWindowSize from 'hooks/use-window-size';
+import SmartMenuContainer from 'containers/smart-menu-container';
+import HeaderContainer from 'containers/header-container';
+import { Layout, Footer } from 'components';
+import { useParams } from 'lib/router';
+
+const ItemListPage = (): ReactElement => {
+ const { code } = useParams() as { code: string };
+ const { width } = useWindowSize();
+ const isMobile = width <= 480;
+
+ return (
+
+
+
+
+ 여기는 아이템 리스트 페이지
+
+
+
+ );
+};
+
+export default ItemListPage;
diff --git a/client/src/pages/main-page.tsx b/client/src/pages/main-page.tsx
index 5121840..0ebae4d 100644
--- a/client/src/pages/main-page.tsx
+++ b/client/src/pages/main-page.tsx
@@ -14,7 +14,7 @@ const MainPage = (): ReactElement => {
-
+
From 16b5d8450d37e90cefe4feb93c0d725d1c519570 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Wed, 18 Aug 2021 18:31:01 +0900
Subject: [PATCH 106/163] =?UTF-8?q?feat:=20=EC=8A=A4=EB=A7=88=ED=8A=B8=20?=
=?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=96=B4=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20?=
=?UTF-8?q?=EC=9D=B4=EB=8F=99=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/smart-menu/large-menu.tsx | 27 +++++++++++++++++--
.../src/components/smart-menu/medium-menu.tsx | 26 +++++++++++++++++-
2 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index 4bc0847..0524047 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -1,5 +1,6 @@
-import React, { FC } from 'react';
+import React, { FC, useCallback } from 'react';
import woowahan from 'lib/woowahan-components';
+import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
import { SMART_MENU_BLOCK_DELAY } from '../../constants';
@@ -29,7 +30,6 @@ const LargeItem = woowahan.li`
font-family: ${({ theme }) => theme?.fontHannaAir};
display: flex;
background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
-
border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
${({ theme }) => theme?.mobile} {
@@ -46,7 +46,27 @@ const LargeItem = woowahan.li`
}
`;
+const GoCategoryButton = woowahan.div`
+ font-family: ${({ theme }) => theme?.fontHannaAir};
+ visibility: ${props => (props.isSelected ? 'visible' : 'hidden')};
+ ${({ theme }) => theme?.mobile} {
+ width: 110px;
+ font-size: 16px;
+ }
+ ${({ theme }) => theme?.tablet} {
+ width: 150px;
+ font-size: 18px;
+ }
+ ${({ theme }) => theme?.laptop} {
+ width: 200px;
+ font-size: 22px;
+ }
+`;
+
const LargeMenu: FC = ({ menu, position, selectedLargeId, isLaptop, setLargeId, setPosition }) => {
+ const history = useHistory();
+ const goCategoryPage = useCallback((code: string) => () => history.push(`/item/category/${code}`), [history]);
+
return (
{menu.data.map(large => {
@@ -72,6 +92,9 @@ const LargeMenu: FC = ({ menu, position, selectedLargeId, isLapt
isSelected={selectedLargeId === largeId}
>
{large.name}
+
+ 이동
+
);
})}
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index 170007c..ef4503b 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -1,5 +1,6 @@
-import React, { FC } from 'react';
+import React, { FC, useCallback } from 'react';
import woowahan from 'lib/woowahan-components';
+import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
interface MediumMenuProps {
@@ -35,7 +36,27 @@ const MediumItem = woowahan.ul`
}
`;
+const GoCategoryButton = woowahan.div`
+ font-family: ${({ theme }) => theme?.fontHannaAir};
+ visibility: ${props => (props.isSelected ? 'visible' : 'hidden')};
+ ${({ theme }) => theme?.mobile} {
+ width: 110px;
+ font-size: 16px;
+ }
+ ${({ theme }) => theme?.tablet} {
+ width: 150px;
+ font-size: 18px;
+ }
+ ${({ theme }) => theme?.laptop} {
+ width: 200px;
+ font-size: 22px;
+ }
+`;
+
const MediumMenu: FC = ({ menu, selectedLargeId, selectedMediumId, setMediumId }) => {
+ const history = useHistory();
+ const goCategoryPage = useCallback((code: string) => () => history.push(`/item/category/${code}`), [history]);
+
return (
{menu.data.map(large => {
@@ -52,6 +73,9 @@ const MediumMenu: FC = ({ menu, selectedLargeId, selectedMedium
isSelected={selectedMediumId === mediumId}
>
{medium.name}
+
+ 이동
+
);
});
From e91f9d53133ff9b4fac9ed22c1ecbf6c6d2af23f Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 02:02:41 +0900
Subject: [PATCH 107/163] =?UTF-8?q?style:=EC=9D=B4=EB=8F=99=20=EB=B2=84?=
=?UTF-8?q?=ED=8A=BC=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=B6=94=EA=B0=80,?=
=?UTF-8?q?=20=EC=8A=A4=EB=A7=88=ED=8A=B8=20=EB=A9=94=EB=89=B4=20=EC=8A=A4?=
=?UTF-8?q?=ED=83=80=EC=9D=BC=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/assets/icons/arrow_forward.png | Bin 0 -> 117 bytes
.../src/components/smart-menu/large-menu.tsx | 28 ++++++++++++++----
.../src/components/smart-menu/medium-menu.tsx | 27 +++++++++++++----
.../src/components/smart-menu/small-menu.tsx | 4 +--
.../src/containers/smart-menu-container.tsx | 1 -
5 files changed, 45 insertions(+), 15 deletions(-)
create mode 100644 client/src/assets/icons/arrow_forward.png
diff --git a/client/src/assets/icons/arrow_forward.png b/client/src/assets/icons/arrow_forward.png
new file mode 100644
index 0000000000000000000000000000000000000000..a873ca0d6d57716a47565f067ddb51b6e5121904
GIT binary patch
literal 117
zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*18&4O<5R22v2@?Aj$Z>cw+~V0U
z`ET+v)hQ*qi6s|>{6cmAe>_yBm9d~p-y=lME%>R58n2O%eCNsP3`U0BekWT#wtq4}
Pa~M2b{an^LB{Ts5`0OGC
literal 0
HcmV?d00001
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index 0524047..c43df38 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -2,6 +2,7 @@ import React, { FC, useCallback } from 'react';
import woowahan from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
+import arrow from 'assets/icons/arrow_forward.png';
import { SMART_MENU_BLOCK_DELAY } from '../../constants';
interface LargeMenuProps {
@@ -32,6 +33,8 @@ const LargeItem = woowahan.li`
background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
+ align-items: center;
+ justify-content: space-between;
${({ theme }) => theme?.mobile} {
width: 110px;
font-size: 16px;
@@ -46,23 +49,38 @@ const LargeItem = woowahan.li`
}
`;
+const LargeTitle = woowahan.div`
+ padding-top: 3px;
+`;
+
const GoCategoryButton = woowahan.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
visibility: ${props => (props.isSelected ? 'visible' : 'hidden')};
${({ theme }) => theme?.mobile} {
- width: 110px;
font-size: 16px;
}
${({ theme }) => theme?.tablet} {
- width: 150px;
font-size: 18px;
}
${({ theme }) => theme?.laptop} {
- width: 200px;
font-size: 22px;
}
`;
+const Image = woowahan.img`
+ ${({ theme }) => theme?.mobile} {
+ width: 20px;
+ }
+ ${({ theme }) => theme?.tablet} {
+ width: 22px;
+ }
+ ${({ theme }) => theme?.laptop} {
+ position: relative;
+ top: -1px;
+ width: 24px;
+ }
+`;
+
const LargeMenu: FC = ({ menu, position, selectedLargeId, isLaptop, setLargeId, setPosition }) => {
const history = useHistory();
const goCategoryPage = useCallback((code: string) => () => history.push(`/item/category/${code}`), [history]);
@@ -91,9 +109,9 @@ const LargeMenu: FC = ({ menu, position, selectedLargeId, isLapt
}}
isSelected={selectedLargeId === largeId}
>
- {large.name}
+ {large.name}
- 이동
+
);
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index ef4503b..3045f4e 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -2,6 +2,7 @@ import React, { FC, useCallback } from 'react';
import woowahan from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
+import arrow from 'assets/icons/arrow_forward.png';
interface MediumMenuProps {
menu: IMenu;
@@ -19,7 +20,8 @@ const MediumItem = woowahan.ul`
writing-mode: horizontal-tb;
text-orientation: sideways;
background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
-
+ display: flex;
+ justify-content: space-between;
border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
${({ theme }) => theme?.mobile} {
@@ -36,23 +38,36 @@ const MediumItem = woowahan.ul`
}
`;
+const MediumTitle = woowahan.div`
+ padding-top: 3px;
+`;
+
const GoCategoryButton = woowahan.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
visibility: ${props => (props.isSelected ? 'visible' : 'hidden')};
${({ theme }) => theme?.mobile} {
- width: 110px;
font-size: 16px;
}
${({ theme }) => theme?.tablet} {
- width: 150px;
font-size: 18px;
}
${({ theme }) => theme?.laptop} {
- width: 200px;
font-size: 22px;
}
`;
+const Image = woowahan.img`
+ ${({ theme }) => theme?.mobile} {
+ width: 20px;
+ }
+ ${({ theme }) => theme?.tablet} {
+ width: 22px;
+ }
+ ${({ theme }) => theme?.laptop} {
+ width: 24px;
+ }
+`;
+
const MediumMenu: FC = ({ menu, selectedLargeId, selectedMediumId, setMediumId }) => {
const history = useHistory();
const goCategoryPage = useCallback((code: string) => () => history.push(`/item/category/${code}`), [history]);
@@ -72,9 +87,9 @@ const MediumMenu: FC = ({ menu, selectedLargeId, selectedMedium
}}
isSelected={selectedMediumId === mediumId}
>
- {medium.name}
+ {medium.name}
- 이동
+
);
diff --git a/client/src/components/smart-menu/small-menu.tsx b/client/src/components/smart-menu/small-menu.tsx
index 9990743..1f6cd80 100644
--- a/client/src/components/smart-menu/small-menu.tsx
+++ b/client/src/components/smart-menu/small-menu.tsx
@@ -17,9 +17,7 @@ const SmallItem = woowahan.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
font-size: 26px;
background-color: ${({ theme }) => theme?.colorBg};
-
- border: 1px solid ${({ theme }) => theme?.colorOffWhite};
- padding: 10px;
+ padding: 5px 10px;
${({ theme }) => theme?.mobile} {
width: 110px;
font-size: 16px;
diff --git a/client/src/containers/smart-menu-container.tsx b/client/src/containers/smart-menu-container.tsx
index 82ed5ac..39327fd 100644
--- a/client/src/containers/smart-menu-container.tsx
+++ b/client/src/containers/smart-menu-container.tsx
@@ -42,7 +42,6 @@ const SmartMenuContainer: FC = ({ currentCode }) => {
data: category.categories.data,
}));
const currentName = currentCode ? data.find(category => category.code === currentCode)?.name : '캇테고리';
- console.log(currentCode, currentName);
return ;
};
From 11bfd4a9400f8926b4253038a6a4f97c5bc3a29d Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 17:16:20 +0900
Subject: [PATCH 108/163] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=EC=9D=B4=EB=8F=99=20=ED=9B=84=20=EC=9E=90=EB=8F=99?=
=?UTF-8?q?=EB=8B=AB=ED=9E=98=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/index.tsx | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index 9328c80..9457922 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,4 +1,4 @@
-import React, { useState, FC } from 'react';
+import React, { useState, FC, useEffect } from 'react';
import woowahan from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import { IMenu } from 'types/category';
@@ -61,8 +61,14 @@ const SmartMenu: FC = ({ currentMenu, menu }) => {
const [selectedLargeId, setLargeId] = useState('');
const [selectedMediumId, setMediumId] = useState('');
const [position, setPosition] = useState({ x: 0, y: 0 });
+ const [menuName, setMenuName] = useState('');
const { width } = useWindowSize();
+ if (currentMenu !== menuName) {
+ setMenuName(currentMenu);
+ setOpenStatus(false);
+ }
+
return (
{
@@ -87,7 +93,7 @@ const SmartMenu: FC = ({ currentMenu, menu }) => {
setPosition={setPosition}
/>
)}
- {selectedLargeId !== '' && (
+ {isOpen && selectedLargeId !== '' && (
= ({ currentMenu, menu }) => {
setMediumId={setMediumId}
/>
)}
- {!isSmall(width) && selectedMediumId !== '' && (
+ {isOpen && !isSmall(width) && selectedMediumId !== '' && (
)}
Date: Thu, 19 Aug 2021 17:27:46 +0900
Subject: [PATCH 109/163] =?UTF-8?q?style:=20=EB=A9=94=EB=89=B4=20=EC=9C=84?=
=?UTF-8?q?=EC=B9=98=20=EC=A1=B0=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index 9457922..00dc7bb 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -15,7 +15,7 @@ interface SmartMenuProps {
const MenuDiv = woowahan.div`
cursor: pointer;
position: fixed;
- top: 200px;
+ top: 10%;
left: -27px;
display: inline-block;
writing-mode: vertical-lr;
From b8781afd08caddebc6826e03b2cf35f721937ea1 Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 17:28:13 +0900
Subject: [PATCH 110/163] =?UTF-8?q?style:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20?=
=?UTF-8?q?=ED=99=94=EB=A9=B4=20=ED=8F=B0=ED=8A=B8=20=EC=82=AC=EC=9D=B4?=
=?UTF-8?q?=EC=A6=88=20=EB=B0=8F=20=EB=84=93=EC=9D=B4=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/large-menu.tsx | 4 ++--
client/src/components/smart-menu/medium-menu.tsx | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index c43df38..fe2dcdb 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -36,7 +36,7 @@ const LargeItem = woowahan.li`
align-items: center;
justify-content: space-between;
${({ theme }) => theme?.mobile} {
- width: 110px;
+ width: 130px;
font-size: 16px;
}
${({ theme }) => theme?.tablet} {
@@ -69,7 +69,7 @@ const GoCategoryButton = woowahan.div`
const Image = woowahan.img`
${({ theme }) => theme?.mobile} {
- width: 20px;
+ width: 16px;
}
${({ theme }) => theme?.tablet} {
width: 22px;
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index 3045f4e..138a9fb 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -21,11 +21,12 @@ const MediumItem = woowahan.ul`
text-orientation: sideways;
background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
display: flex;
+ align-items: center;
justify-content: space-between;
border: 1px solid ${({ theme }) => theme?.colorOffWhite};
padding: 10px;
${({ theme }) => theme?.mobile} {
- width: 110px;
+ width: 130px;
font-size: 16px;
}
${({ theme }) => theme?.tablet} {
@@ -58,7 +59,7 @@ const GoCategoryButton = woowahan.div`
const Image = woowahan.img`
${({ theme }) => theme?.mobile} {
- width: 20px;
+ width: 16px;
}
${({ theme }) => theme?.tablet} {
width: 22px;
From 8bfaa99441663ae268885d38283bc5675eb87fc9 Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 20:08:19 +0900
Subject: [PATCH 111/163] =?UTF-8?q?chore:=20=EC=9A=B0=EC=95=84=ED=95=9C=20?=
=?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=9E=84=ED=8F=AC?=
=?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=EB=AC=B8=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/index.tsx | 8 ++++----
client/src/components/smart-menu/large-menu.tsx | 14 +++++++-------
client/src/components/smart-menu/medium-menu.tsx | 12 ++++++------
client/src/components/smart-menu/small-menu.tsx | 6 +++---
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index 00dc7bb..23c2fa9 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,5 +1,5 @@
-import React, { useState, FC, useEffect } from 'react';
-import woowahan from 'lib/woowahan-components';
+import React, { useState, FC } from 'react';
+import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
import { IMenu } from 'types/category';
import { SMART_MENU_LARGE_WIDTH, SMART_MENU_SMALL_WIDTH, SMART_MENU_BLOCK_DELAY } from '../../constants';
@@ -12,7 +12,7 @@ interface SmartMenuProps {
menu: IMenu;
}
-const MenuDiv = woowahan.div`
+const MenuDiv = styled.div`
cursor: pointer;
position: fixed;
top: 10%;
@@ -29,7 +29,7 @@ const MenuDiv = woowahan.div`
z-index: 1000;
`;
-const MenuTitle = woowahan.div`
+const MenuTitle = styled.div`
padding-left: 20px;
color: ${({ theme }) => theme?.colorLineDark};
font-family: ${({ theme }) => theme?.fontHanna};
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index fe2dcdb..38dfd57 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -1,5 +1,5 @@
import React, { FC, useCallback } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
import arrow from 'assets/icons/arrow_forward.png';
@@ -19,7 +19,7 @@ interface LargeMenuProps {
>;
}
-const LargeItemDiv = woowahan.ul`
+const LargeItemDiv = styled.ul`
writing-mode: horizontal-tb;
text-orientation: sideways;
background-color: ${({ theme }) => theme?.colorBg};
@@ -27,7 +27,7 @@ const LargeItemDiv = woowahan.ul`
padding-left: 32px;
`;
-const LargeItem = woowahan.li`
+const LargeItem = styled.li`
font-family: ${({ theme }) => theme?.fontHannaAir};
display: flex;
background-color: ${props => (props.isSelected ? props.theme?.colorOffWhite : props.theme?.colorBg)};
@@ -49,11 +49,11 @@ const LargeItem = woowahan.li`
}
`;
-const LargeTitle = woowahan.div`
- padding-top: 3px;
+const LargeTitle = styled.div`
+ padding-top: 3px;
`;
-const GoCategoryButton = woowahan.div`
+const GoCategoryButton = styled.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
visibility: ${props => (props.isSelected ? 'visible' : 'hidden')};
${({ theme }) => theme?.mobile} {
@@ -67,7 +67,7 @@ const GoCategoryButton = woowahan.div`
}
`;
-const Image = woowahan.img`
+const Image = styled.img`
${({ theme }) => theme?.mobile} {
width: 16px;
}
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index 138a9fb..b32c06e 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -1,5 +1,5 @@
import React, { FC, useCallback } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
import arrow from 'assets/icons/arrow_forward.png';
@@ -11,11 +11,11 @@ interface MediumMenuProps {
setMediumId: React.Dispatch>;
}
-const MediumItemDiv = woowahan.div`
+const MediumItemDiv = styled.div`
display: flex;
`;
-const MediumItem = woowahan.ul`
+const MediumItem = styled.ul`
font-family: ${({ theme }) => theme?.fontHannaAir};
writing-mode: horizontal-tb;
text-orientation: sideways;
@@ -39,11 +39,11 @@ const MediumItem = woowahan.ul`
}
`;
-const MediumTitle = woowahan.div`
+const MediumTitle = styled.div`
padding-top: 3px;
`;
-const GoCategoryButton = woowahan.div`
+const GoCategoryButton = styled.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
visibility: ${props => (props.isSelected ? 'visible' : 'hidden')};
${({ theme }) => theme?.mobile} {
@@ -57,7 +57,7 @@ const GoCategoryButton = woowahan.div`
}
`;
-const Image = woowahan.img`
+const Image = styled.img`
${({ theme }) => theme?.mobile} {
width: 16px;
}
diff --git a/client/src/components/smart-menu/small-menu.tsx b/client/src/components/smart-menu/small-menu.tsx
index 1f6cd80..63c8167 100644
--- a/client/src/components/smart-menu/small-menu.tsx
+++ b/client/src/components/smart-menu/small-menu.tsx
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
-import woowahan from 'lib/woowahan-components';
+import styled from 'lib/woowahan-components';
import { IMenu } from 'types/category';
interface SmallMenuProps {
@@ -8,12 +8,12 @@ interface SmallMenuProps {
selectedMediumId: string;
}
-const SmallItemDiv = woowahan.div`
+const SmallItemDiv = styled.div`
writing-mode: horizontal-tb;
text-orientation: sideways;
`;
-const SmallItem = woowahan.div`
+const SmallItem = styled.div`
font-family: ${({ theme }) => theme?.fontHannaAir};
font-size: 26px;
background-color: ${({ theme }) => theme?.colorBg};
From 6177874bf4b6ee222d3e4e239b43b1571341772c Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 22:05:25 +0900
Subject: [PATCH 112/163] =?UTF-8?q?style:=20=EB=A9=94=EB=89=B4=20=EC=8A=A4?=
=?UTF-8?q?=ED=83=80=EC=9D=BC=20=EC=82=AC=ED=8C=8C=EB=A6=AC=20=EC=98=A4?=
=?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/smart-menu/large-menu.tsx | 67 ++++++++++---------
1 file changed, 37 insertions(+), 30 deletions(-)
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index 38dfd57..a629a76 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -19,10 +19,15 @@ interface LargeMenuProps {
>;
}
-const LargeItemDiv = styled.ul`
+const LargeItemDiv = styled.div`
+ display: grid;
+`;
+
+const LargeItemUl = styled.ul`
writing-mode: horizontal-tb;
text-orientation: sideways;
background-color: ${({ theme }) => theme?.colorBg};
+
border-radius: 20px;
padding-left: 32px;
`;
@@ -87,35 +92,37 @@ const LargeMenu: FC = ({ menu, position, selectedLargeId, isLapt
return (
- {menu.data.map(large => {
- const largeId = large.code.slice(0, 2);
- return (
- {
- if (isLaptop) {
- setTimeout(() => {
- if (e.clientX < position.x + 10) {
- setLargeId(largeId);
- }
- setPosition({ x: e.clientX, y: e.clientY });
- }, SMART_MENU_BLOCK_DELAY);
- }
- }}
- onClick={() => {
- if (!isLaptop) {
- setLargeId(largeId);
- }
- }}
- isSelected={selectedLargeId === largeId}
- >
- {large.name}
-
-
-
-
- );
- })}
+
+ {menu.data.map(large => {
+ const largeId = large.code.slice(0, 2);
+ return (
+ {
+ if (isLaptop) {
+ setTimeout(() => {
+ if (e.clientX < position.x + 10) {
+ setLargeId(largeId);
+ }
+ setPosition({ x: e.clientX, y: e.clientY });
+ }, SMART_MENU_BLOCK_DELAY);
+ }
+ }}
+ onClick={() => {
+ if (!isLaptop) {
+ setLargeId(largeId);
+ }
+ }}
+ isSelected={selectedLargeId === largeId}
+ >
+ {large.name}
+
+
+
+
+ );
+ })}
+
);
};
From e9fffe3469cd2f9618b92c4db2ebd2fe5c398f82 Mon Sep 17 00:00:00 2001
From: negu63
Date: Thu, 19 Aug 2021 22:35:53 +0900
Subject: [PATCH 113/163] =?UTF-8?q?chore:=20=EC=B6=A9=EB=8F=8C=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/common/layout.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/client/src/components/common/layout.tsx b/client/src/components/common/layout.tsx
index a4c9d7c..438bc1e 100644
--- a/client/src/components/common/layout.tsx
+++ b/client/src/components/common/layout.tsx
@@ -12,6 +12,7 @@ const Wrapper = styled.div`
padding: 0 10%;
display: flex;
flex-direction: column;
+ justify-content: center;
}
${props => props.theme?.mobile} {
From ab398cf67920ae44633b6f508fbe7541296dec98 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 22:44:06 +0900
Subject: [PATCH 114/163] =?UTF-8?q?feat:=20url=20=EC=83=81=EC=88=98=20?=
=?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/constants/urls.ts | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 client/src/constants/urls.ts
diff --git a/client/src/constants/urls.ts b/client/src/constants/urls.ts
new file mode 100644
index 0000000..83db5a4
--- /dev/null
+++ b/client/src/constants/urls.ts
@@ -0,0 +1,12 @@
+export const MAIN_URL = '/';
+export const ITEM_LIST_URL = '/items';
+export const ITEM_URL = '/item';
+export const CART_URL = '/cart';
+export const PAYMENT_URL = '/pay';
+export const ORDER_LIST_URL = '/my/order';
+export const ADDRESS_URL = '/my/address';
+export const REVIEW_URL = '/my/review';
+
+export const SIGNIN_URL = '/signin';
+export const SIGNUP_URL = '/signup';
+export const AUTH_URL = '/auth';
From 462b6345791d857b48abd4cb5c69650eab001eec Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 22:44:53 +0900
Subject: [PATCH 115/163] =?UTF-8?q?refactor:=20=EB=AA=A8=EB=93=A0=20?=
=?UTF-8?q?=EC=9D=B4=EB=8F=99=20Path=20=EC=83=81=EC=88=98=EB=A1=9C=20?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 15 +++++++++------
client/src/components/auth/form.tsx | 5 +++--
client/src/components/common/header.tsx | 3 ++-
client/src/components/common/navbar.tsx | 9 +++++----
client/src/components/item/item-list.tsx | 4 +++-
client/src/containers/login-container.tsx | 3 ++-
client/src/containers/search-container.tsx | 4 +++-
client/src/containers/signup-container.tsx | 5 +++--
client/src/pages/auth-page.tsx | 3 ++-
9 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 602c2f1..8975cc6 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -2,6 +2,9 @@ import React from 'react';
import { BrowserRouter, Switch, Route } from 'lib/router';
import { MainPage, NotFoundPage, LoginPage, SignupPage, AuthPage, ItemDetailPage, CategoryPage } from 'pages';
+
+import { MAIN_URL, ITEM_LIST_URL, ITEM_URL, AUTH_URL, SIGNIN_URL, SIGNUP_URL } from 'constants/urls';
+
import Theme from './styles/theme';
const App: React.FC = () => {
@@ -9,12 +12,12 @@ const App: React.FC = () => {
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/client/src/components/auth/form.tsx b/client/src/components/auth/form.tsx
index df74f69..51e3d3e 100644
--- a/client/src/components/auth/form.tsx
+++ b/client/src/components/auth/form.tsx
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
import woowahan from 'lib/woowahan-components';
import { Link } from 'lib/router';
import { Input, Button } from 'components';
+import { SIGNIN_URL, SIGNUP_URL } from 'constants/urls';
import baedal from 'assets/icons/baedalee.png';
import github from 'assets/icons/github.png';
@@ -143,7 +144,7 @@ const AuthForm: FC = ({
{isSignup ? (
- 계정이 있다면? 로그인하러 가기
+ 계정이 있다면? 로그인하러 가기
) : (
<>
@@ -152,7 +153,7 @@ const AuthForm: FC = ({
깃-헙으로 로그인
- 계정이 없다면? 회원가입하러 가기
+ 계정이 없다면? 회원가입하러 가기
>
)}
diff --git a/client/src/components/common/header.tsx b/client/src/components/common/header.tsx
index f6f1858..dba9a15 100644
--- a/client/src/components/common/header.tsx
+++ b/client/src/components/common/header.tsx
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
import woowahan from 'lib/woowahan-components';
import { Link } from 'lib/router';
import { Logo, Navbar } from 'components';
+import { MAIN_URL } from 'constants/urls';
import BrickBg from 'assets/images/brick.png';
import TentBg from 'assets/images/tent.png';
@@ -63,7 +64,7 @@ const Header: FC = ({ displayMain, isMobile, userId, onLogout }) =>
}
return (
-
+
diff --git a/client/src/components/common/navbar.tsx b/client/src/components/common/navbar.tsx
index 077ad88..c590dc5 100644
--- a/client/src/components/common/navbar.tsx
+++ b/client/src/components/common/navbar.tsx
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
import { Link } from 'lib/router';
import woowahan from 'lib/woowahan-components';
import { Logo } from 'components';
+import { MAIN_URL, CART_URL, SIGNIN_URL, ORDER_LIST_URL } from 'constants/urls';
import accountIcon from 'assets/icons/account.png';
import cartIcon from 'assets/icons/cart.png';
@@ -59,17 +60,17 @@ const Navbar: FC = ({ white = false, mobile = false, userId, onLogo
return (
{mobile && (
-
+
)}
{userId && (
-
+
{mobile ?
: '마이페이지'}
)}
-
+
{mobile ?
: '장바구니'}
{userId ? (
@@ -77,7 +78,7 @@ const Navbar: FC
= ({ white = false, mobile = false, userId, onLogo
{mobile ? : '로그아웃'}
) : (
-
+
{mobile ? : '로그인'}
)}
diff --git a/client/src/components/item/item-list.tsx b/client/src/components/item/item-list.tsx
index 0bdd4e5..d8c977f 100644
--- a/client/src/components/item/item-list.tsx
+++ b/client/src/components/item/item-list.tsx
@@ -3,6 +3,7 @@ import styled from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IItem } from 'types/item';
import Item from 'components/item';
+import { ITEM_URL } from 'constants/urls';
interface ItemListProps {
items: IItem[] | null;
@@ -29,7 +30,8 @@ const Wrapper = styled.div`
const ItemList: FC = ({ items }) => {
const history = useHistory();
- const goDetailPage = useCallback((id: number) => () => history.push(`/item/${id}`), [history]);
+
+ const goDetailPage = useCallback((id: number) => () => history.push(`${ITEM_URL}/${id}`), [history]);
return (
diff --git a/client/src/containers/login-container.tsx b/client/src/containers/login-container.tsx
index 930d339..2feafa9 100644
--- a/client/src/containers/login-container.tsx
+++ b/client/src/containers/login-container.tsx
@@ -7,6 +7,7 @@ import useInputs from 'hooks/use-inputs';
import AuthForm from 'components/auth/form';
import authValidation from 'utils/validation/auth-validation';
import { IAuth } from 'types/auth';
+import { MAIN_URL } from 'constants/urls';
const LoginContainer: FC = () => {
const history = useHistory();
@@ -33,7 +34,7 @@ const LoginContainer: FC = () => {
useEffect(() => {
if (userId || userLoading) {
- history.push('/');
+ history.push(MAIN_URL);
}
}, [userId, history, userLoading]);
diff --git a/client/src/containers/search-container.tsx b/client/src/containers/search-container.tsx
index 0655f39..3487610 100644
--- a/client/src/containers/search-container.tsx
+++ b/client/src/containers/search-container.tsx
@@ -7,6 +7,8 @@ import SearchBar from 'components/search-bar';
import { RootState } from 'store';
import { getAutoComplete } from 'store/item';
+export const ITEM_LIST_URL = '/items';
+
const SearchContainer: FC = () => {
const [search, setSearch] = useState('');
const [keywords, setKeywords] = useState([]);
@@ -56,7 +58,7 @@ const SearchContainer: FC = () => {
setSearch(keyword);
saveRecentKeywords(keyword);
// TODO: url이 정해지면 이동 수정
- history.push(`/items?search=${keyword}`);
+ history.push(`${ITEM_LIST_URL}?search=${keyword}`);
};
const onChange = (e: React.ChangeEvent) => {
diff --git a/client/src/containers/signup-container.tsx b/client/src/containers/signup-container.tsx
index 32b47e1..f6c5554 100644
--- a/client/src/containers/signup-container.tsx
+++ b/client/src/containers/signup-container.tsx
@@ -8,6 +8,7 @@ import AuthForm from 'components/auth/form';
import AuthSuccessModal from 'components/auth/success-modal';
import authValidation from 'utils/validation/auth-validation';
import { IAuth } from 'types/auth';
+import { MAIN_URL } from 'constants/urls';
const SignupContainer: FC = () => {
const history = useHistory();
@@ -34,12 +35,12 @@ const SignupContainer: FC = () => {
}, [error]);
useEffect(() => {
- if (userLoading) history.push('/');
+ if (userLoading) history.push(MAIN_URL);
if (userId) {
setModal(true);
setTimeout(() => {
setModal(false);
- history.push('/');
+ history.push(MAIN_URL);
}, 1000);
}
}, [userId, history, userLoading]);
diff --git a/client/src/pages/auth-page.tsx b/client/src/pages/auth-page.tsx
index dba914a..f08b807 100644
--- a/client/src/pages/auth-page.tsx
+++ b/client/src/pages/auth-page.tsx
@@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import { getGithubLogin } from 'store/auth';
import { IUser } from 'types/auth';
+import { MAIN_URL } from 'constants/urls';
const AuthPage = (): null => {
const { userId }: IUser = useSelector(({ auth }: RootState) => ({
@@ -15,7 +16,7 @@ const AuthPage = (): null => {
dispatch({ type: getGithubLogin.type, payload: { code: window.location.search.slice(22) } });
}, [dispatch]);
useEffect(() => {
- if (userId) history.push('/');
+ if (userId) history.push(MAIN_URL);
}, [userId, history]);
return null;
};
From 32daa758afb598f75bfe3cb6c764e449cd631a46 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 23:15:37 +0900
Subject: [PATCH 116/163] =?UTF-8?q?refactor:=20react=20router=20pathname?=
=?UTF-8?q?=20=EC=A0=80=EC=9E=A5=EC=8B=9C=20=EC=BF=BC=EB=A6=AC=20=EC=A0=9C?=
=?UTF-8?q?=EC=99=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/lib/router/components/browser-router.tsx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/client/src/lib/router/components/browser-router.tsx b/client/src/lib/router/components/browser-router.tsx
index 733ab1c..5269050 100644
--- a/client/src/lib/router/components/browser-router.tsx
+++ b/client/src/lib/router/components/browser-router.tsx
@@ -13,13 +13,15 @@ const BrowserRouter: FC = ({ children }) => {
}, [handlePopState]);
const push = useCallback((pathname: string) => {
+ const pathnameWithoutQuery = pathname.split('?')[0];
window.history.pushState(null, '', pathname);
- setCurrentPath(pathname);
+ setCurrentPath(pathnameWithoutQuery);
}, []);
const replace = useCallback((pathname: string) => {
+ const pathnameWithoutQuery = pathname.split('?')[0];
window.history.replaceState(null, '', pathname);
- setCurrentPath(pathname);
+ setCurrentPath(pathnameWithoutQuery);
}, []);
const goBack = useCallback(() => {
From ab3c60a8e6f3842b81d6c0a94ce5955b59373b8e Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 23:15:53 +0900
Subject: [PATCH 117/163] =?UTF-8?q?fix:=20useQuery=20hooks=20=ED=8F=B4?=
=?UTF-8?q?=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/hooks/use-query.ts | 16 ++++++++++++++++
client/src/utils/index.ts | 14 --------------
2 files changed, 16 insertions(+), 14 deletions(-)
create mode 100644 client/src/hooks/use-query.ts
diff --git a/client/src/hooks/use-query.ts b/client/src/hooks/use-query.ts
new file mode 100644
index 0000000..7e8dee8
--- /dev/null
+++ b/client/src/hooks/use-query.ts
@@ -0,0 +1,16 @@
+interface IQuery {
+ [key: string]: string;
+}
+
+const useQuery = (): IQuery => {
+ const { search } = window.location;
+
+ const params: IQuery = {};
+ search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (str: string, key: string, value: string): string => {
+ params[key] = value;
+ return '';
+ });
+ return params;
+};
+
+export default useQuery;
diff --git a/client/src/utils/index.ts b/client/src/utils/index.ts
index 477544f..3e6ecd7 100644
--- a/client/src/utils/index.ts
+++ b/client/src/utils/index.ts
@@ -1,17 +1,3 @@
-interface IQuery {
- [key: string]: string;
-}
-
-export const useQuery = (): IQuery => {
- const { search } = window.location;
- const params: IQuery = {};
- search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (str: string, key: string, value: string): string => {
- params[key] = value;
- return '';
- });
- return params;
-};
-
export const formatPrice = (price: string | number): string => {
const parsePrice = typeof price === 'string' ? parseInt(price, 10) : price;
return parsePrice.toLocaleString('ko-KR');
From 0ed5e4a1a629fc5e35f856cfdcb16e509c092efb Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 23:16:58 +0900
Subject: [PATCH 118/163] =?UTF-8?q?refactor:=20url=20=EC=83=81=EC=88=98?=
=?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 4 ++--
client/src/components/smart-menu/large-menu.tsx | 6 +++++-
client/src/components/smart-menu/medium-menu.tsx | 6 +++++-
client/src/pages/item-list-page.tsx | 6 +++---
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 4346491..e2d206b 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -24,9 +24,9 @@ const App: React.FC = () => {
-
+
+
-
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index a629a76..2073e7b 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -2,6 +2,7 @@ import React, { FC, useCallback } from 'react';
import styled from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
+import { ITEM_LIST_URL } from 'constants/urls';
import arrow from 'assets/icons/arrow_forward.png';
import { SMART_MENU_BLOCK_DELAY } from '../../constants';
@@ -88,7 +89,10 @@ const Image = styled.img`
const LargeMenu: FC = ({ menu, position, selectedLargeId, isLaptop, setLargeId, setPosition }) => {
const history = useHistory();
- const goCategoryPage = useCallback((code: string) => () => history.push(`/item/category/${code}`), [history]);
+ const goCategoryPage = useCallback(
+ (code: string) => () => history.push(`${ITEM_LIST_URL}?category=${code}`),
+ [history],
+ );
return (
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index b32c06e..858ae56 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -2,6 +2,7 @@ import React, { FC, useCallback } from 'react';
import styled from 'lib/woowahan-components';
import { useHistory } from 'lib/router';
import { IMenu } from 'types/category';
+import { ITEM_LIST_URL } from 'constants/urls';
import arrow from 'assets/icons/arrow_forward.png';
interface MediumMenuProps {
@@ -71,7 +72,10 @@ const Image = styled.img`
const MediumMenu: FC = ({ menu, selectedLargeId, selectedMediumId, setMediumId }) => {
const history = useHistory();
- const goCategoryPage = useCallback((code: string) => () => history.push(`/item/category/${code}`), [history]);
+ const goCategoryPage = useCallback(
+ (code: string) => () => history.push(`${ITEM_LIST_URL}?category=${code}`),
+ [history],
+ );
return (
diff --git a/client/src/pages/item-list-page.tsx b/client/src/pages/item-list-page.tsx
index 2da0060..7fcaf74 100644
--- a/client/src/pages/item-list-page.tsx
+++ b/client/src/pages/item-list-page.tsx
@@ -3,10 +3,10 @@ import useWindowSize from 'hooks/use-window-size';
import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-import { useParams } from 'lib/router';
+import useQuery from 'hooks/use-query';
const ItemListPage = (): ReactElement => {
- const { code } = useParams() as { code: string };
+ const { category, search } = useQuery();
const { width } = useWindowSize();
const isMobile = width <= 480;
@@ -14,7 +14,7 @@ const ItemListPage = (): ReactElement => {
-
+
여기는 아이템 리스트 페이지
From ed4500aa86988f78d967fe73eedb513bb01931d6 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Thu, 19 Aug 2021 23:24:26 +0900
Subject: [PATCH 119/163] =?UTF-8?q?fix:=20useQuery=20=EA=B2=BD=EB=A1=9C=20?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/category-container.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/containers/category-container.tsx b/client/src/containers/category-container.tsx
index 8ff903d..b0eda4e 100644
--- a/client/src/containers/category-container.tsx
+++ b/client/src/containers/category-container.tsx
@@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import CategoryItems from 'components/item/category-items';
import { getCategoryItems } from 'store/items';
-import { useQuery } from 'utils';
+import useQuery from 'hooks/use-query';
const CategoryItemContainer: FC = () => {
const { items, loading } = useSelector(({ items, loading }: RootState) => ({
From ca1b3a890f99c52018f1ab055b0909f581da6195 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Fri, 20 Aug 2021 01:54:51 +0900
Subject: [PATCH 120/163] =?UTF-8?q?refactor:=20useQuery=20router=EC=97=90?=
=?UTF-8?q?=20=EB=82=B4=EC=9E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 무한 리로딩이 될 수 있는 여지 제거
---
client/src/hooks/use-query.ts | 16 ---------
.../lib/router/components/browser-router.tsx | 34 ++++++++++++++-----
.../src/lib/router/context/router-context.ts | 6 ++++
client/src/lib/router/hooks/use-query.ts | 7 ++++
client/src/lib/router/index.ts | 1 +
5 files changed, 39 insertions(+), 25 deletions(-)
delete mode 100644 client/src/hooks/use-query.ts
create mode 100644 client/src/lib/router/hooks/use-query.ts
diff --git a/client/src/hooks/use-query.ts b/client/src/hooks/use-query.ts
deleted file mode 100644
index 7e8dee8..0000000
--- a/client/src/hooks/use-query.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-interface IQuery {
- [key: string]: string;
-}
-
-const useQuery = (): IQuery => {
- const { search } = window.location;
-
- const params: IQuery = {};
- search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (str: string, key: string, value: string): string => {
- params[key] = value;
- return '';
- });
- return params;
-};
-
-export default useQuery;
diff --git a/client/src/lib/router/components/browser-router.tsx b/client/src/lib/router/components/browser-router.tsx
index 5269050..18dd4a2 100644
--- a/client/src/lib/router/components/browser-router.tsx
+++ b/client/src/lib/router/components/browser-router.tsx
@@ -1,27 +1,42 @@
import React, { FC, useCallback, useState, useEffect } from 'react';
-import { RouterContext } from '../context/router-context';
+import { RouterContext, IQuery } from '../context/router-context';
+
+const searchToQuery = (search: string) => {
+ const queries = new URLSearchParams(search);
+ const params: IQuery = {};
+ queries.forEach((value, key) => {
+ params[key] = value;
+ });
+ return params;
+};
const BrowserRouter: FC = ({ children }) => {
const [currentPath, setCurrentPath] = useState(window.location.pathname);
+ const [query, setQuery] = useState(searchToQuery(window.location.search));
const handlePopState = useCallback(() => {
setCurrentPath(window.location.pathname);
+ setQuery(searchToQuery(window.location.search));
}, []);
useEffect(() => {
window.addEventListener('popstate', handlePopState);
}, [handlePopState]);
- const push = useCallback((pathname: string) => {
- const pathnameWithoutQuery = pathname.split('?')[0];
- window.history.pushState(null, '', pathname);
- setCurrentPath(pathnameWithoutQuery);
+ const push = useCallback((url: string) => {
+ const pathname = url.split('?')[0];
+ const search = url.split('?')[1];
+ window.history.pushState(null, '', url);
+ setCurrentPath(pathname);
+ setQuery(searchToQuery(search));
}, []);
- const replace = useCallback((pathname: string) => {
- const pathnameWithoutQuery = pathname.split('?')[0];
- window.history.replaceState(null, '', pathname);
- setCurrentPath(pathnameWithoutQuery);
+ const replace = useCallback((url: string) => {
+ const pathname = url.split('?')[0];
+ const search = url.split('?')[1];
+ window.history.replaceState(null, '', url);
+ setCurrentPath(pathname);
+ setQuery(searchToQuery(search));
}, []);
const goBack = useCallback(() => {
@@ -30,6 +45,7 @@ const BrowserRouter: FC = ({ children }) => {
const value = {
currentPath,
+ query,
push,
replace,
goBack,
diff --git a/client/src/lib/router/context/router-context.ts b/client/src/lib/router/context/router-context.ts
index 93cf4c6..625a40c 100644
--- a/client/src/lib/router/context/router-context.ts
+++ b/client/src/lib/router/context/router-context.ts
@@ -1,7 +1,12 @@
import { createContext } from 'react';
+export interface IQuery {
+ [key: string]: string;
+}
+
export interface IRouterContext {
currentPath: string;
+ query: IQuery;
push: (pathname: string) => void;
replace: (pathname: string) => void;
goBack: () => void;
@@ -9,6 +14,7 @@ export interface IRouterContext {
export const RouterContext = createContext({
currentPath: '',
+ query: {},
push: () => {},
replace: () => {},
goBack: () => {},
diff --git a/client/src/lib/router/hooks/use-query.ts b/client/src/lib/router/hooks/use-query.ts
new file mode 100644
index 0000000..c0c34b2
--- /dev/null
+++ b/client/src/lib/router/hooks/use-query.ts
@@ -0,0 +1,7 @@
+import useHistory from './use-history';
+
+import { IQuery } from '../context/router-context';
+
+const useQuery = (): IQuery => useHistory().query;
+
+export default useQuery;
diff --git a/client/src/lib/router/index.ts b/client/src/lib/router/index.ts
index 11bc863..d55235b 100644
--- a/client/src/lib/router/index.ts
+++ b/client/src/lib/router/index.ts
@@ -5,3 +5,4 @@ export { default as Link } from './components/link';
export { default as useParams } from './hooks/use-params';
export { default as useHistory } from './hooks/use-history';
+export { default as useQuery } from './hooks/use-query';
From 027ce8f657e4d736cbe4e467236eebe3332f950f Mon Sep 17 00:00:00 2001
From: edegiil
Date: Fri, 20 Aug 2021 01:55:17 +0900
Subject: [PATCH 121/163] =?UTF-8?q?refactor:=20=EC=95=84=EC=9D=B4=ED=85=9C?=
=?UTF-8?q?=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?=
=?UTF-8?q?useQuery=20=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/pages/item-list-page.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/client/src/pages/item-list-page.tsx b/client/src/pages/item-list-page.tsx
index 7fcaf74..489f9e0 100644
--- a/client/src/pages/item-list-page.tsx
+++ b/client/src/pages/item-list-page.tsx
@@ -3,10 +3,10 @@ import useWindowSize from 'hooks/use-window-size';
import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
-import useQuery from 'hooks/use-query';
+import { useQuery } from 'lib/router';
const ItemListPage = (): ReactElement => {
- const { category, search } = useQuery();
+ const query = useQuery();
const { width } = useWindowSize();
const isMobile = width <= 480;
@@ -14,7 +14,7 @@ const ItemListPage = (): ReactElement => {
-
+
여기는 아이템 리스트 페이지
From af4a02851c9152a1f7d8c01e7d71ac9b0c923cf0 Mon Sep 17 00:00:00 2001
From: edegiil
Date: Fri, 20 Aug 2021 02:03:23 +0900
Subject: [PATCH 122/163] =?UTF-8?q?fix:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88=20useQuery=20?=
=?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EA=B3=A0=EC=B9=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/category-container.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/containers/category-container.tsx b/client/src/containers/category-container.tsx
index b0eda4e..e5811bc 100644
--- a/client/src/containers/category-container.tsx
+++ b/client/src/containers/category-container.tsx
@@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import CategoryItems from 'components/item/category-items';
import { getCategoryItems } from 'store/items';
-import useQuery from 'hooks/use-query';
+import { useQuery } from 'lib/router';
const CategoryItemContainer: FC = () => {
const { items, loading } = useSelector(({ items, loading }: RootState) => ({
From b7cab5c726105e724b251cee0f44f6e0a79240de Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 21:58:57 +0900
Subject: [PATCH 123/163] =?UTF-8?q?feat:=20=EA=B2=80=EC=83=89=20=EC=95=84?=
=?UTF-8?q?=EC=9D=B4=ED=85=9C=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=BF=BC?=
=?UTF-8?q?=EB=A6=AC=EB=AC=B8=20=EC=9E=91=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/repositories/items.ts | 47 +++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/server/src/repositories/items.ts b/server/src/repositories/items.ts
index e7aa262..530a359 100644
--- a/server/src/repositories/items.ts
+++ b/server/src/repositories/items.ts
@@ -78,4 +78,49 @@ const getCategoryItems = async (
return items;
};
-export default { getMainItems, getCategoryItems };
+const getSearchItems = async (
+ pageId: number,
+ order: string[][],
+ regExp: string,
+): Promise[]> => {
+ const items = await db.Item.findAll({
+ attributes: [
+ 'id',
+ 'title',
+ 'thumbnail',
+ 'price',
+ ['sale_percent', 'salePercent'],
+ 'amount',
+ ['is_green', 'isGreen'],
+ ],
+ order: order as Order,
+ where: {
+ title: {
+ [Op.regexp]: regExp,
+ },
+ },
+ offset: (pageId - 1) * 8 + 1,
+ limit: 12,
+ include: [
+ {
+ model: db.Category,
+ attributes: [],
+ },
+ ],
+ });
+
+ if (!items) {
+ throw errorGenerator({
+ message: 'POST /api/items - items not found',
+ code: 'items/not-found',
+ });
+ }
+
+ items.forEach(v => {
+ v.setDataValue('isGreen', v.getDataValue('isGreen') === 1);
+ });
+
+ return items;
+};
+
+export default { getMainItems, getCategoryItems, getSearchItems };
From 8a86e6a7de590809ec45630e9165a5478d183158 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 21:59:35 +0900
Subject: [PATCH 124/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EA=B2=80=EC=83=89=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EA=B3=84?=
=?UTF-8?q?=EC=B8=B5=20=EC=9E=91=EC=84=B1.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 카테고리와 검색 합치기
---
server/src/services/items.ts | 39 ++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/server/src/services/items.ts b/server/src/services/items.ts
index 0949102..fd1c925 100644
--- a/server/src/services/items.ts
+++ b/server/src/services/items.ts
@@ -2,6 +2,7 @@ import itemRepository from 'repositories/items';
import { ItemAttributes, ItemCreationAttributes } from 'models/item';
import { Model } from 'sequelize';
import errorGenerator from 'utils/error/error-generator';
+import { getRegExp, engToKor } from 'korean-regexp';
async function mainItems(): Promise[][]> {
const items = await Promise.all([
@@ -13,23 +14,24 @@ async function mainItems(): Promise[]> {
if (
- !(
- categoryId ||
- type ||
- categoryId.length === 6 ||
- ['recommend', 'popular', 'recent ', 'cheap', 'expensive'].includes(type)
- )
- )
+ (categoryId && search) ||
+ (!categoryId && !search) ||
+ (categoryId && categoryId.length !== 6) ||
+ Number.isNaN(pageId)
+ ) {
throw errorGenerator({
message: 'POST /api/item - no exist querystring',
code: 'item/no-exist-querystring',
});
+ }
+
const order = [];
// recommend 수정 예정
if (type === 'recommend') order.push(['sale_count', 'DESC']);
@@ -37,12 +39,27 @@ async function categoryItems(
else if (type === 'recent') order.push(['updatedAt', 'DESC']);
else if (type === 'cheap') order.push(['price', 'ASC']);
else if (type === 'expensive') order.push(['price', 'DESC']);
- const categoryReg = categoryId.slice(2, 4) === '00' ? categoryId.slice(0, 2) : categoryId.slice(0, 4);
- const items = await itemRepository.getCategoryItems(pageId, order, categoryReg);
+
+ let items;
+ if (categoryId) {
+ let categoryReg = '';
+ if (categoryReg) {
+ if (categoryId.slice(2, 4) === '00') categoryReg = categoryId.slice(0, 2);
+ else categoryId.slice(0, 4);
+ }
+ items = await itemRepository.getCategoryItems(pageId, order, categoryReg);
+ } else {
+ const regExp = String(
+ getRegExp(engToKor(search), {
+ initialSearch: true,
+ }),
+ );
+ items = await itemRepository.getSearchItems(pageId, order, regExp.substring(0, regExp.length - 2).slice(1));
+ }
return items;
}
export default {
mainItems,
- categoryItems,
+ getItems,
};
From 8efeef4bd28b85d7787a77ff0bf6551d3a85473b Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 22:02:43 +0900
Subject: [PATCH 125/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EA=B2=80=EC=83=89=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20?=
=?UTF-8?q?=EC=9E=91=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/controllers/items.ts | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/server/src/controllers/items.ts b/server/src/controllers/items.ts
index d709bb7..a452470 100644
--- a/server/src/controllers/items.ts
+++ b/server/src/controllers/items.ts
@@ -4,7 +4,12 @@ import itemService from 'services/items';
import errorHandler from 'utils/error/error-handler';
-type IRequest = Request;
+type IRequest = Request<
+ unknown,
+ unknown,
+ unknown,
+ { categoryId: string; type: string; pageId: number; search: string }
+>;
export const getMainItems = async (req: Request, res: Response): Promise => {
try {
@@ -17,10 +22,10 @@ export const getMainItems = async (req: Request, res: Response): Promise =
}
};
-export const getCategoryItems = async (req: IRequest, res: Response): Promise => {
- const { categoryId, pageId, type } = req.query;
+export const getItems = async (req: IRequest, res: Response): Promise => {
+ const { categoryId, pageId, type, search } = req.query;
try {
- const items = await itemService.categoryItems(categoryId, pageId, type);
+ const items = await itemService.getItems(categoryId, pageId, type, search);
res.status(200).json(items);
} catch (err) {
console.log(err);
From cc97bdf4f988464ca78fb14572ef20bb385f6322 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Thu, 19 Aug 2021 22:02:58 +0900
Subject: [PATCH 126/163] =?UTF-8?q?wip:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=97=94=EB=93=9C=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/routes/items/index.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/src/routes/items/index.ts b/server/src/routes/items/index.ts
index 3a896f8..3ccdc25 100644
--- a/server/src/routes/items/index.ts
+++ b/server/src/routes/items/index.ts
@@ -1,9 +1,9 @@
import { Router } from 'express';
-import { getCategoryItems, getMainItems } from 'controllers/items';
+import { getItems, getMainItems } from 'controllers/items';
const router = Router();
router.get('/main', getMainItems);
-router.get('/category', getCategoryItems);
+router.get('/', getItems);
export default router;
From 39307bd0f6b118d6483739d3fb6a0c88f12f6b62 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 02:49:21 +0900
Subject: [PATCH 127/163] =?UTF-8?q?wip:=20=EC=A3=BC=EC=84=9D=20todo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/services/items.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/src/services/items.ts b/server/src/services/items.ts
index fd1c925..fb876fd 100644
--- a/server/src/services/items.ts
+++ b/server/src/services/items.ts
@@ -10,7 +10,7 @@ async function mainItems(): Promise
Date: Fri, 20 Aug 2021 03:03:23 +0900
Subject: [PATCH 128/163] =?UTF-8?q?wip:=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?=
=?UTF-8?q?=EB=9F=AC=20=EC=BF=BC=EB=A6=AC=20=EC=9D=B8=ED=84=B0=ED=8E=98?=
=?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/controllers/items.ts | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/server/src/controllers/items.ts b/server/src/controllers/items.ts
index a452470..3ae9548 100644
--- a/server/src/controllers/items.ts
+++ b/server/src/controllers/items.ts
@@ -4,12 +4,12 @@ import itemService from 'services/items';
import errorHandler from 'utils/error/error-handler';
-type IRequest = Request<
- unknown,
- unknown,
- unknown,
- { categoryId: string; type: string; pageId: number; search: string }
->;
+interface IQuery {
+ categoryId: string;
+ type: string;
+ pageId: number;
+ search: string;
+}
export const getMainItems = async (req: Request, res: Response): Promise => {
try {
@@ -22,7 +22,7 @@ export const getMainItems = async (req: Request, res: Response): Promise =
}
};
-export const getItems = async (req: IRequest, res: Response): Promise => {
+export const getItems = async (req: Request, res: Response): Promise => {
const { categoryId, pageId, type, search } = req.query;
try {
const items = await itemService.getItems(categoryId, pageId, type, search);
From 1840ce8a6b9e82f3f2e256997c15bafaea8f0108 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:52:19 +0900
Subject: [PATCH 129/163] =?UTF-8?q?wip:=20=EC=B9=B4=ED=85=8C=EA=B3=A0?=
=?UTF-8?q?=EB=A6=AC=20=EB=AA=A8=EB=93=A0=EB=A9=94=EB=89=B4=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
server/src/services/items.ts | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/server/src/services/items.ts b/server/src/services/items.ts
index fb876fd..2fe0ab4 100644
--- a/server/src/services/items.ts
+++ b/server/src/services/items.ts
@@ -25,12 +25,11 @@ async function getItems(
(!categoryId && !search) ||
(categoryId && categoryId.length !== 6) ||
Number.isNaN(pageId)
- ) {
+ )
throw errorGenerator({
message: 'POST /api/item - no exist querystring',
code: 'item/no-exist-querystring',
});
- }
const order = [];
// TODO recommend 수정 예정
@@ -43,10 +42,10 @@ async function getItems(
let items;
if (categoryId) {
let categoryReg = '';
- if (categoryReg) {
- if (categoryId.slice(2, 4) === '00') categoryReg = categoryId.slice(0, 2);
- else categoryId.slice(0, 4);
- }
+ if (categoryId === '000000') categoryReg = '';
+ else if (categoryId.slice(2, 4) === '00') categoryReg = categoryId.slice(0, 2);
+ else categoryReg = categoryId.slice(0, 4);
+
items = await itemRepository.getCategoryItems(pageId, order, categoryReg);
} else {
const regExp = String(
@@ -54,6 +53,7 @@ async function getItems(
initialSearch: true,
}),
);
+
items = await itemRepository.getSearchItems(pageId, order, regExp.substring(0, regExp.length - 2).slice(1));
}
return items;
From cfc80302445b83a8f4c629182d86c5a651acd160 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:54:11 +0900
Subject: [PATCH 130/163] =?UTF-8?q?wip:=20=EC=95=84=EC=9D=B4=ED=85=9C=20ap?=
=?UTF-8?q?i=20=EC=BF=BC=EB=A6=AC=EC=8A=A4=ED=8A=B8=EB=A7=81=20=EC=A0=81?=
=?UTF-8?q?=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/utils/api/items.ts | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/client/src/utils/api/items.ts b/client/src/utils/api/items.ts
index f6aa3ca..73a27ce 100644
--- a/client/src/utils/api/items.ts
+++ b/client/src/utils/api/items.ts
@@ -5,5 +5,14 @@ import client from './client';
export const getMainItems = (): Promise => client.get('/api/items/main');
-export const getCategoryItems = ({ categoryId, pageId = 1, type }: IItemsState): Promise =>
- client.get(`/api/items/category?categoryId=${categoryId}&pageId=${pageId}&type=${type}`);
+export const getCategoryItems = ({ categoryId, pageId, type, search }: IItemsState): Promise => {
+ let url = '/api/items?';
+ const arr = [];
+ if (categoryId) arr.push(`categoryId=${categoryId}&`);
+ if (pageId) arr.push(`pageId=${pageId}&`);
+ if (type) arr.push(`type=${type}&`);
+ if (search) arr.push(`search=${search}&`);
+ url += arr.join('');
+ url = url.slice(0, url.length - 1);
+ return client.get(url);
+};
From 4237f305b314d6012c8cc8328319dff1960cf493 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:54:49 +0900
Subject: [PATCH 131/163] =?UTF-8?q?chore:=20=EC=9E=A1=EB=8B=A4=ED=95=9C=20?=
=?UTF-8?q?=EC=9D=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/item/category-items.tsx | 46 -------------------
client/src/pages/category-page.tsx | 24 ----------
client/src/pages/index.ts | 3 +-
client/src/store/items.ts | 5 +-
4 files changed, 4 insertions(+), 74 deletions(-)
delete mode 100644 client/src/components/item/category-items.tsx
delete mode 100644 client/src/pages/category-page.tsx
diff --git a/client/src/components/item/category-items.tsx b/client/src/components/item/category-items.tsx
deleted file mode 100644
index d72850c..0000000
--- a/client/src/components/item/category-items.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import React, { FC } from 'react';
-import styled from 'lib/woowahan-components';
-import { IItem } from 'types/item';
-import ItemList from 'components/item/item-list';
-
-interface ItemListProps {
- items: IItem[] | null;
- loading: boolean;
-}
-
-const Div = styled.div`
- margin-top: 90px;
- ${props => props.theme?.mobile} {
- margin-top: 50px;
- }
-
- ${props => props.theme?.tablet} {
- margin-top: 70px;
- }
-`;
-
-const SmallTitle = styled.div`
- font-family: ${props => props.theme?.fontHanna};
- font-size: 36px;
- ${props => props.theme?.mobile} {
- font-size: 20px;
- margin-left: 50px;
- }
-
- ${props => props.theme?.tablet} {
- font-size: 28px;
- margin-left: 50px;
- }
-`;
-
-const CategoryItems: FC = ({ items, loading }) => {
- return (
-
- {loading &&
로딩중
}
-
총 개수, 추천 등등...
-
-
- );
-};
-
-export default CategoryItems;
diff --git a/client/src/pages/category-page.tsx b/client/src/pages/category-page.tsx
deleted file mode 100644
index dbce697..0000000
--- a/client/src/pages/category-page.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React, { ReactElement } from 'react';
-import useWindowSize from 'hooks/use-window-size';
-import SmartMenuContainer from 'containers/smart-menu-container';
-import HeaderContainer from 'containers/header-container';
-import { Layout, Footer } from 'components';
-import CategoryItemContainer from 'containers/category-container';
-
-const CategoryPage = (): ReactElement => {
- const { width } = useWindowSize();
- const isMobile = width <= 480;
-
- return (
-
-
-
-
-
-
-
-
- );
-};
-
-export default CategoryPage;
diff --git a/client/src/pages/index.ts b/client/src/pages/index.ts
index 5a48155..97942e3 100644
--- a/client/src/pages/index.ts
+++ b/client/src/pages/index.ts
@@ -3,6 +3,5 @@ export { default as MainPage } from './main-page';
export { default as LoginPage } from './login-page';
export { default as SignupPage } from './signup-page';
export { default as ItemDetailPage } from './item-detail-page';
-export { default as ItemListPage } from './item-list-page';
export { default as AuthPage } from './auth-page';
-export { default as CategoryPage } from './category-page';
+export { default as ItemsPage } from './items-page';
diff --git a/client/src/store/items.ts b/client/src/store/items.ts
index ccf5d74..2b12142 100644
--- a/client/src/store/items.ts
+++ b/client/src/store/items.ts
@@ -7,9 +7,10 @@ import { put } from 'redux-saga-test-plan/matchers';
import { finishLoading, startLoading } from './loading';
export interface IItemsState {
- categoryId: string;
+ categoryId?: string;
pageId?: number;
- type: string;
+ type?: string;
+ search?: string;
}
interface IMainItems {
From 4ae3f506f786ca4cf751cac481f22d39f534876e Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:56:28 +0900
Subject: [PATCH 132/163] =?UTF-8?q?feat:=20usequery=EC=BB=A4=EC=8A=A4?=
=?UTF-8?q?=ED=85=80=ED=9B=85=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/lib/router/components/browser-router.tsx | 13 +++++++++++++
client/src/lib/router/context/router-context.ts | 1 +
client/src/lib/router/hooks/use-query.ts | 7 ++-----
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/client/src/lib/router/components/browser-router.tsx b/client/src/lib/router/components/browser-router.tsx
index 18dd4a2..a5e79ea 100644
--- a/client/src/lib/router/components/browser-router.tsx
+++ b/client/src/lib/router/components/browser-router.tsx
@@ -10,6 +10,19 @@ const searchToQuery = (search: string) => {
return params;
};
+export interface IQuery {
+ [key: string]: string;
+}
+
+const searchToQuery = (search: string) => {
+ const queries = new URLSearchParams(search);
+ const params: IQuery = {};
+ queries.forEach((value, key) => {
+ params[key] = value;
+ });
+ return params;
+};
+
const BrowserRouter: FC = ({ children }) => {
const [currentPath, setCurrentPath] = useState(window.location.pathname);
const [query, setQuery] = useState(searchToQuery(window.location.search));
diff --git a/client/src/lib/router/context/router-context.ts b/client/src/lib/router/context/router-context.ts
index 625a40c..2763737 100644
--- a/client/src/lib/router/context/router-context.ts
+++ b/client/src/lib/router/context/router-context.ts
@@ -1,4 +1,5 @@
import { createContext } from 'react';
+import type { IQuery } from '../components/browser-router';
export interface IQuery {
[key: string]: string;
diff --git a/client/src/lib/router/hooks/use-query.ts b/client/src/lib/router/hooks/use-query.ts
index c0c34b2..714b13b 100644
--- a/client/src/lib/router/hooks/use-query.ts
+++ b/client/src/lib/router/hooks/use-query.ts
@@ -1,7 +1,4 @@
+import { IQuery } from '../components/browser-router';
import useHistory from './use-history';
-import { IQuery } from '../context/router-context';
-
-const useQuery = (): IQuery => useHistory().query;
-
-export default useQuery;
+export const useQuery = (): IQuery => useHistory().query;
From 94d0ed8f9afc3ebf9060c27470d20a401132885b Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:58:28 +0900
Subject: [PATCH 133/163] =?UTF-8?q?wip:=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20?=
=?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/lib/router/components/route.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/lib/router/components/route.tsx b/client/src/lib/router/components/route.tsx
index d0e10e2..e0b2248 100644
--- a/client/src/lib/router/components/route.tsx
+++ b/client/src/lib/router/components/route.tsx
@@ -14,7 +14,7 @@ const Route: FC = ({ component, path, exact }) => {
// TODO: 좀 더 세련된 방법으로
const pathSplit = path.split('/');
- const currentPathSplit = currentPath.split('/');
+ const currentPathSplit = currentPath.split('?')[0].split('/');
const arr: [string, number][] = [];
pathSplit.forEach((v, i) => {
From eddaa3a3f53d628d0bea83d3731f0d552db90a44 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:58:54 +0900
Subject: [PATCH 134/163] =?UTF-8?q?wip:=20=EC=8A=A4=EB=A7=88=ED=8A=B8=20?=
=?UTF-8?q?=EB=A9=94=EB=89=B4=EC=97=90=20url=20=EC=9D=B4=EB=8F=99=EC=8B=9C?=
=?UTF-8?q?=20=EB=8B=AB=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/index.tsx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index 23c2fa9..eed117d 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,6 +1,7 @@
-import React, { useState, FC } from 'react';
+import React, { useState, FC, useEffect } from 'react';
import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
+import { useQuery } from 'lib/router/hooks/use-query';
import { IMenu } from 'types/category';
import { SMART_MENU_LARGE_WIDTH, SMART_MENU_SMALL_WIDTH, SMART_MENU_BLOCK_DELAY } from '../../constants';
import LargeMenu from './large-menu';
@@ -63,7 +64,11 @@ const SmartMenu: FC = ({ currentMenu, menu }) => {
const [position, setPosition] = useState({ x: 0, y: 0 });
const [menuName, setMenuName] = useState('');
const { width } = useWindowSize();
+ const query = useQuery();
+ useEffect(() => {
+ setOpenStatus(false);
+ }, [query]);
if (currentMenu !== menuName) {
setMenuName(currentMenu);
setOpenStatus(false);
From 95d826e33d2d25e74eeb9c64de374348df0bab8f Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 01:59:39 +0900
Subject: [PATCH 135/163] =?UTF-8?q?feat:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80(?=
=?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC,=20=EA=B2=80=EC=83=89=20?=
=?UTF-8?q?=ED=95=A9=EC=B3=90=EC=84=9C)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 15 +-------
client/src/components/item/items.tsx | 46 +++++++++++++++++++++++
client/src/containers/items-container.tsx | 22 +++++++++++
client/src/pages/items-page.tsx | 24 ++++++++++++
4 files changed, 94 insertions(+), 13 deletions(-)
create mode 100644 client/src/components/item/items.tsx
create mode 100644 client/src/containers/items-container.tsx
create mode 100644 client/src/pages/items-page.tsx
diff --git a/client/src/App.tsx b/client/src/App.tsx
index e2d206b..697af64 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,19 +1,9 @@
import React from 'react';
import { BrowserRouter, Switch, Route } from 'lib/router';
-import {
- MainPage,
- NotFoundPage,
- LoginPage,
- SignupPage,
- AuthPage,
- ItemDetailPage,
- ItemListPage,
- CategoryPage,
-} from 'pages';
-
import { MAIN_URL, ITEM_LIST_URL, ITEM_URL, AUTH_URL, SIGNIN_URL, SIGNUP_URL } from 'constants/urls';
+import { MainPage, NotFoundPage, LoginPage, SignupPage, AuthPage, ItemDetailPage, ItemsPage } from 'pages';
import Theme from './styles/theme';
const App: React.FC = () => {
@@ -25,8 +15,7 @@ const App: React.FC = () => {
-
-
+
diff --git a/client/src/components/item/items.tsx b/client/src/components/item/items.tsx
new file mode 100644
index 0000000..b3a45f5
--- /dev/null
+++ b/client/src/components/item/items.tsx
@@ -0,0 +1,46 @@
+import React, { FC } from 'react';
+import styled from 'lib/woowahan-components';
+import { IItem } from 'types/item';
+import ItemList from 'components/item/item-list';
+
+interface ItemListProps {
+ items: IItem[] | null;
+ loading: boolean;
+}
+
+const Div = styled.div`
+ margin-top: 90px;
+ ${props => props.theme?.mobile} {
+ margin-top: 50px;
+ }
+
+ ${props => props.theme?.tablet} {
+ margin-top: 70px;
+ }
+`;
+
+const SmallTitle = styled.div`
+ font-family: ${props => props.theme?.fontHanna};
+ font-size: 36px;
+ ${props => props.theme?.mobile} {
+ font-size: 20px;
+ margin-left: 50px;
+ }
+
+ ${props => props.theme?.tablet} {
+ font-size: 28px;
+ margin-left: 50px;
+ }
+`;
+
+const Items: FC = ({ items, loading }) => {
+ return (
+
+ {loading &&
로딩중
}
+
총 개수, 추천 등등...
+
+
+ );
+};
+
+export default Items;
diff --git a/client/src/containers/items-container.tsx b/client/src/containers/items-container.tsx
new file mode 100644
index 0000000..9a2505d
--- /dev/null
+++ b/client/src/containers/items-container.tsx
@@ -0,0 +1,22 @@
+import React, { FC, useEffect } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+import { RootState } from 'store';
+import Items from 'components/item/items';
+import { useQuery } from 'lib/router/hooks/use-query';
+import { getCategoryItems } from 'store/items';
+
+const ItemsContainer: FC = () => {
+ const { items, loading } = useSelector(({ items, loading }: RootState) => ({
+ items: items.items,
+ loading: loading['items/getCategoryItems'],
+ }));
+ const dispatch = useDispatch();
+ const query = useQuery();
+ useEffect(() => {
+ const { categoryId, pageId, type, search } = query;
+ dispatch({ type: getCategoryItems.type, payload: { categoryId, pageId, type, search } });
+ }, [query, dispatch]);
+ return ;
+};
+
+export default ItemsContainer;
diff --git a/client/src/pages/items-page.tsx b/client/src/pages/items-page.tsx
new file mode 100644
index 0000000..5c85a2c
--- /dev/null
+++ b/client/src/pages/items-page.tsx
@@ -0,0 +1,24 @@
+import React, { ReactElement } from 'react';
+import useWindowSize from 'hooks/use-window-size';
+import SmartMenuContainer from 'containers/smart-menu-container';
+import HeaderContainer from 'containers/header-container';
+import { Layout, Footer } from 'components';
+import ItemsContainer from 'containers/items-container';
+
+const ItemsPage = (): ReactElement => {
+ const { width } = useWindowSize();
+ const isMobile = width <= 480;
+
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+export default ItemsPage;
From 214349c9f86189f7af400375eebcf24f203eddd7 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 02:19:21 +0900
Subject: [PATCH 136/163] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=ED=85=9C=20?=
=?UTF-8?q?=ED=97=A4=EB=8D=94=EB=AA=A8=EC=96=91=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/pages/items-page.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/pages/items-page.tsx b/client/src/pages/items-page.tsx
index 5c85a2c..86c27d2 100644
--- a/client/src/pages/items-page.tsx
+++ b/client/src/pages/items-page.tsx
@@ -11,7 +11,7 @@ const ItemsPage = (): ReactElement => {
return (
-
+
From d06fa3bc26d9d4fe1b6682fd2b404a83d21f8534 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 02:34:04 +0900
Subject: [PATCH 137/163] =?UTF-8?q?fix:=20=EC=84=9C=EC=B9=98=20=EC=BB=A8?=
=?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=84=88=20=EC=9D=B4=EB=A6=84=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/pages/items-page.tsx | 2 ++
client/src/pages/main-page.tsx | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/client/src/pages/items-page.tsx b/client/src/pages/items-page.tsx
index 86c27d2..0d3253a 100644
--- a/client/src/pages/items-page.tsx
+++ b/client/src/pages/items-page.tsx
@@ -4,6 +4,7 @@ import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
import ItemsContainer from 'containers/items-container';
+import SearchContainer from 'containers/search-container';
const ItemsPage = (): ReactElement => {
const { width } = useWindowSize();
@@ -14,6 +15,7 @@ const ItemsPage = (): ReactElement => {
+
diff --git a/client/src/pages/main-page.tsx b/client/src/pages/main-page.tsx
index 0ebae4d..3c759eb 100644
--- a/client/src/pages/main-page.tsx
+++ b/client/src/pages/main-page.tsx
@@ -4,7 +4,7 @@ import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import MainItemContainer from 'containers/main-item-container';
import { Layout, Footer } from 'components';
-import SearchBar from 'containers/search-container';
+import SearchContainer from 'containers/search-container';
const MainPage = (): ReactElement => {
const { width } = useWindowSize();
@@ -15,7 +15,7 @@ const MainPage = (): ReactElement => {
-
+
From 0ea5fb0640a4139257866d7778604f490cfea424 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 03:31:48 +0900
Subject: [PATCH 138/163] =?UTF-8?q?wip:=20=EC=B6=A9=EB=8F=8C=EB=B3=91?=
=?UTF-8?q?=ED=95=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/index.tsx | 2 +-
.../src/components/smart-menu/large-menu.tsx | 2 +-
.../src/components/smart-menu/medium-menu.tsx | 2 +-
client/src/containers/category-container.tsx | 21 -------------------
client/src/containers/items-container.tsx | 3 ++-
.../lib/router/components/browser-router.tsx | 13 ------------
.../src/lib/router/context/router-context.ts | 1 -
client/src/lib/router/hooks/use-query.ts | 6 ++++--
client/src/store/items.ts | 2 +-
client/src/utils/api/items.ts | 2 +-
10 files changed, 11 insertions(+), 43 deletions(-)
delete mode 100644 client/src/containers/category-container.tsx
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index eed117d..e33bfb1 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -1,7 +1,7 @@
import React, { useState, FC, useEffect } from 'react';
import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
-import { useQuery } from 'lib/router/hooks/use-query';
+import { useQuery } from 'lib/router';
import { IMenu } from 'types/category';
import { SMART_MENU_LARGE_WIDTH, SMART_MENU_SMALL_WIDTH, SMART_MENU_BLOCK_DELAY } from '../../constants';
import LargeMenu from './large-menu';
diff --git a/client/src/components/smart-menu/large-menu.tsx b/client/src/components/smart-menu/large-menu.tsx
index 2073e7b..4214d4a 100644
--- a/client/src/components/smart-menu/large-menu.tsx
+++ b/client/src/components/smart-menu/large-menu.tsx
@@ -90,7 +90,7 @@ const Image = styled.img`
const LargeMenu: FC = ({ menu, position, selectedLargeId, isLaptop, setLargeId, setPosition }) => {
const history = useHistory();
const goCategoryPage = useCallback(
- (code: string) => () => history.push(`${ITEM_LIST_URL}?category=${code}`),
+ (code: string) => () => history.push(`${ITEM_LIST_URL}?categoryId=${code}`),
[history],
);
diff --git a/client/src/components/smart-menu/medium-menu.tsx b/client/src/components/smart-menu/medium-menu.tsx
index 858ae56..123c37d 100644
--- a/client/src/components/smart-menu/medium-menu.tsx
+++ b/client/src/components/smart-menu/medium-menu.tsx
@@ -73,7 +73,7 @@ const Image = styled.img`
const MediumMenu: FC = ({ menu, selectedLargeId, selectedMediumId, setMediumId }) => {
const history = useHistory();
const goCategoryPage = useCallback(
- (code: string) => () => history.push(`${ITEM_LIST_URL}?category=${code}`),
+ (code: string) => () => history.push(`${ITEM_LIST_URL}?categoryId=${code}`),
[history],
);
diff --git a/client/src/containers/category-container.tsx b/client/src/containers/category-container.tsx
deleted file mode 100644
index e5811bc..0000000
--- a/client/src/containers/category-container.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React, { FC, useEffect } from 'react';
-import { useDispatch, useSelector } from 'react-redux';
-import { RootState } from 'store';
-import CategoryItems from 'components/item/category-items';
-import { getCategoryItems } from 'store/items';
-import { useQuery } from 'lib/router';
-
-const CategoryItemContainer: FC = () => {
- const { items, loading } = useSelector(({ items, loading }: RootState) => ({
- items: items.items,
- loading: loading['items/getCategoryItems'],
- }));
- const dispatch = useDispatch();
- const { categoryId, pageId, type } = useQuery();
- useEffect(() => {
- dispatch({ type: getCategoryItems.type, payload: { categoryId, pageId, type } });
- }, [dispatch, categoryId, pageId, type]);
- return ;
-};
-
-export default CategoryItemContainer;
diff --git a/client/src/containers/items-container.tsx b/client/src/containers/items-container.tsx
index 9a2505d..8c590d5 100644
--- a/client/src/containers/items-container.tsx
+++ b/client/src/containers/items-container.tsx
@@ -2,7 +2,7 @@ import React, { FC, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import Items from 'components/item/items';
-import { useQuery } from 'lib/router/hooks/use-query';
+import { useQuery } from 'lib/router';
import { getCategoryItems } from 'store/items';
const ItemsContainer: FC = () => {
@@ -13,6 +13,7 @@ const ItemsContainer: FC = () => {
const dispatch = useDispatch();
const query = useQuery();
useEffect(() => {
+ console.log('123123', query);
const { categoryId, pageId, type, search } = query;
dispatch({ type: getCategoryItems.type, payload: { categoryId, pageId, type, search } });
}, [query, dispatch]);
diff --git a/client/src/lib/router/components/browser-router.tsx b/client/src/lib/router/components/browser-router.tsx
index a5e79ea..18dd4a2 100644
--- a/client/src/lib/router/components/browser-router.tsx
+++ b/client/src/lib/router/components/browser-router.tsx
@@ -10,19 +10,6 @@ const searchToQuery = (search: string) => {
return params;
};
-export interface IQuery {
- [key: string]: string;
-}
-
-const searchToQuery = (search: string) => {
- const queries = new URLSearchParams(search);
- const params: IQuery = {};
- queries.forEach((value, key) => {
- params[key] = value;
- });
- return params;
-};
-
const BrowserRouter: FC = ({ children }) => {
const [currentPath, setCurrentPath] = useState(window.location.pathname);
const [query, setQuery] = useState(searchToQuery(window.location.search));
diff --git a/client/src/lib/router/context/router-context.ts b/client/src/lib/router/context/router-context.ts
index 2763737..625a40c 100644
--- a/client/src/lib/router/context/router-context.ts
+++ b/client/src/lib/router/context/router-context.ts
@@ -1,5 +1,4 @@
import { createContext } from 'react';
-import type { IQuery } from '../components/browser-router';
export interface IQuery {
[key: string]: string;
diff --git a/client/src/lib/router/hooks/use-query.ts b/client/src/lib/router/hooks/use-query.ts
index 714b13b..fc2831c 100644
--- a/client/src/lib/router/hooks/use-query.ts
+++ b/client/src/lib/router/hooks/use-query.ts
@@ -1,4 +1,6 @@
-import { IQuery } from '../components/browser-router';
+import { IQuery } from '../context/router-context';
import useHistory from './use-history';
-export const useQuery = (): IQuery => useHistory().query;
+const useQuery = (): IQuery => useHistory().query;
+
+export default useQuery;
diff --git a/client/src/store/items.ts b/client/src/store/items.ts
index 2b12142..5515c01 100644
--- a/client/src/store/items.ts
+++ b/client/src/store/items.ts
@@ -97,7 +97,7 @@ function* getMainItemsSaga(): Generator {
function* getCategoryItemsSaga(action: PayloadAction): Generator {
try {
yield put(startLoading(getCategoryItems.type));
- const { data } = (yield call(itemsAPI.getCategoryItems, action.payload as unknown as IItemsState)) as AxiosResponse<
+ const { data } = (yield call(itemsAPI.getItems, action.payload as unknown as IItemsState)) as AxiosResponse<
IItem[]
>;
yield put({ type: getCategoryItemsSuccess.type, payload: data });
diff --git a/client/src/utils/api/items.ts b/client/src/utils/api/items.ts
index 73a27ce..66beae8 100644
--- a/client/src/utils/api/items.ts
+++ b/client/src/utils/api/items.ts
@@ -5,7 +5,7 @@ import client from './client';
export const getMainItems = (): Promise => client.get('/api/items/main');
-export const getCategoryItems = ({ categoryId, pageId, type, search }: IItemsState): Promise => {
+export const getItems = ({ categoryId, pageId, type, search }: IItemsState): Promise => {
let url = '/api/items?';
const arr = [];
if (categoryId) arr.push(`categoryId=${categoryId}&`);
From 892030c916f97ebf0b666c5c233cabe3d04f1532 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 03:36:03 +0900
Subject: [PATCH 139/163] =?UTF-8?q?fix:=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/containers/items-container.tsx | 7 +++---
client/src/store/items.ts | 29 +++++++++--------------
client/src/store/loading.ts | 2 +-
3 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/client/src/containers/items-container.tsx b/client/src/containers/items-container.tsx
index 8c590d5..5c81e35 100644
--- a/client/src/containers/items-container.tsx
+++ b/client/src/containers/items-container.tsx
@@ -3,19 +3,18 @@ import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import Items from 'components/item/items';
import { useQuery } from 'lib/router';
-import { getCategoryItems } from 'store/items';
+import { getItems } from 'store/items';
const ItemsContainer: FC = () => {
const { items, loading } = useSelector(({ items, loading }: RootState) => ({
items: items.items,
- loading: loading['items/getCategoryItems'],
+ loading: loading['items/getItems'],
}));
const dispatch = useDispatch();
const query = useQuery();
useEffect(() => {
- console.log('123123', query);
const { categoryId, pageId, type, search } = query;
- dispatch({ type: getCategoryItems.type, payload: { categoryId, pageId, type, search } });
+ dispatch({ type: getItems.type, payload: { categoryId, pageId, type, search } });
}, [query, dispatch]);
return ;
};
diff --git a/client/src/store/items.ts b/client/src/store/items.ts
index 5515c01..efe8835 100644
--- a/client/src/store/items.ts
+++ b/client/src/store/items.ts
@@ -55,11 +55,11 @@ const counterSlice = createSlice({
state.error = action.payload;
return state;
},
- getCategoryItems: state => state,
- getCategoryItemsSuccess: (state, action: PayloadAction) => {
+ getItems: state => state,
+ getItemsSuccess: (state, action: PayloadAction) => {
state.items = action.payload as unknown as IItem[];
},
- getCategoryItemsFail: (state, action: PayloadAction) => {
+ getItemsFail: (state, action: PayloadAction) => {
state.error = action.payload;
return state;
},
@@ -67,15 +67,8 @@ const counterSlice = createSlice({
});
const { actions, reducer: itemsReducer } = counterSlice;
-const {
- getMainItems,
- getMainItemsSuccess,
- getMainItemsFail,
- getCategoryItems,
- getCategoryItemsSuccess,
- getCategoryItemsFail,
-} = actions;
-export { getMainItems, getCategoryItems, itemsReducer };
+const { getMainItems, getMainItemsSuccess, getMainItemsFail, getItems, getItemsSuccess, getItemsFail } = actions;
+export { getMainItems, getItems, itemsReducer };
function* getMainItemsSaga(): Generator {
try {
@@ -94,26 +87,26 @@ function* getMainItemsSaga(): Generator {
}
}
-function* getCategoryItemsSaga(action: PayloadAction): Generator {
+function* getItemsSaga(action: PayloadAction): Generator {
try {
- yield put(startLoading(getCategoryItems.type));
+ yield put(startLoading(getItems.type));
const { data } = (yield call(itemsAPI.getItems, action.payload as unknown as IItemsState)) as AxiosResponse<
IItem[]
>;
- yield put({ type: getCategoryItemsSuccess.type, payload: data });
+ yield put({ type: getItemsSuccess.type, payload: data });
} catch (e) {
if (axios.isAxiosError(e)) {
const { errorMessage } = e.response?.data as IError;
- yield put({ type: getCategoryItemsFail.type, payload: errorMessage });
+ yield put({ type: getItemsFail.type, payload: errorMessage });
} else {
throw new Error(e);
}
} finally {
- yield put(finishLoading(getCategoryItems.type));
+ yield put(finishLoading(getItems.type));
}
}
export function* itemsSaga(): Generator {
yield takeLatest(getMainItems, getMainItemsSaga);
- yield takeLatest(getCategoryItems, getCategoryItemsSaga);
+ yield takeLatest(getItems, getItemsSaga);
}
diff --git a/client/src/store/loading.ts b/client/src/store/loading.ts
index 730ed28..42aea12 100644
--- a/client/src/store/loading.ts
+++ b/client/src/store/loading.ts
@@ -7,7 +7,7 @@ const loadingSlice = createSlice({
'auth/getUser': false,
'auth/getSignup': false,
'items/getMainItems': false,
- 'items/getCategoryItems': false,
+ 'items/getItems': false,
},
reducers: {
startLoading: (state, action) => ({ ...state, [action.payload]: true }),
From 3ef41e6f809aefd2339632b14aeb0f0fc302e855 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 03:50:53 +0900
Subject: [PATCH 140/163] =?UTF-8?q?fix:=20=EB=B3=91=ED=95=A9=EC=B6=A9?=
=?UTF-8?q?=EB=8F=8C=20=EC=82=AC=ED=95=AD=20=ED=95=B4=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/App.tsx | 4 ++--
client/src/components/smart-menu/index.tsx | 2 +-
client/src/pages/index.ts | 2 +-
client/src/pages/item-list-page.tsx | 7 ++++--
client/src/pages/items-page.tsx | 26 ----------------------
5 files changed, 9 insertions(+), 32 deletions(-)
delete mode 100644 client/src/pages/items-page.tsx
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 697af64..52b8966 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -3,7 +3,7 @@ import { BrowserRouter, Switch, Route } from 'lib/router';
import { MAIN_URL, ITEM_LIST_URL, ITEM_URL, AUTH_URL, SIGNIN_URL, SIGNUP_URL } from 'constants/urls';
-import { MainPage, NotFoundPage, LoginPage, SignupPage, AuthPage, ItemDetailPage, ItemsPage } from 'pages';
+import { MainPage, NotFoundPage, ItemListPage, LoginPage, SignupPage, AuthPage, ItemDetailPage } from 'pages';
import Theme from './styles/theme';
const App: React.FC = () => {
@@ -15,7 +15,7 @@ const App: React.FC = () => {
-
+
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index e33bfb1..2ff87cd 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -65,7 +65,7 @@ const SmartMenu: FC = ({ currentMenu, menu }) => {
const [menuName, setMenuName] = useState('');
const { width } = useWindowSize();
const query = useQuery();
-
+ console.log(currentMenu, menuName, menu);
useEffect(() => {
setOpenStatus(false);
}, [query]);
diff --git a/client/src/pages/index.ts b/client/src/pages/index.ts
index 97942e3..4a461ec 100644
--- a/client/src/pages/index.ts
+++ b/client/src/pages/index.ts
@@ -4,4 +4,4 @@ export { default as LoginPage } from './login-page';
export { default as SignupPage } from './signup-page';
export { default as ItemDetailPage } from './item-detail-page';
export { default as AuthPage } from './auth-page';
-export { default as ItemsPage } from './items-page';
+export { default as ItemListPage } from './item-list-page';
diff --git a/client/src/pages/item-list-page.tsx b/client/src/pages/item-list-page.tsx
index 489f9e0..a5405ea 100644
--- a/client/src/pages/item-list-page.tsx
+++ b/client/src/pages/item-list-page.tsx
@@ -4,6 +4,8 @@ import SmartMenuContainer from 'containers/smart-menu-container';
import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
import { useQuery } from 'lib/router';
+import SearchContainer from 'containers/search-container';
+import ItemsContainer from 'containers/items-container';
const ItemListPage = (): ReactElement => {
const query = useQuery();
@@ -14,8 +16,9 @@ const ItemListPage = (): ReactElement => {
-
- 여기는 아이템 리스트 페이지
+
+
+
diff --git a/client/src/pages/items-page.tsx b/client/src/pages/items-page.tsx
deleted file mode 100644
index 0d3253a..0000000
--- a/client/src/pages/items-page.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import React, { ReactElement } from 'react';
-import useWindowSize from 'hooks/use-window-size';
-import SmartMenuContainer from 'containers/smart-menu-container';
-import HeaderContainer from 'containers/header-container';
-import { Layout, Footer } from 'components';
-import ItemsContainer from 'containers/items-container';
-import SearchContainer from 'containers/search-container';
-
-const ItemsPage = (): ReactElement => {
- const { width } = useWindowSize();
- const isMobile = width <= 480;
-
- return (
-
-
-
-
-
-
-
-
-
- );
-};
-
-export default ItemsPage;
From 91410af41b6ff157b89f4dee3f063c4ad6ce4dd9 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 03:52:21 +0900
Subject: [PATCH 141/163] =?UTF-8?q?fix:=20=EC=BD=98=EC=86=94=EC=A0=9C?=
=?UTF-8?q?=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/src/components/smart-menu/index.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/client/src/components/smart-menu/index.tsx b/client/src/components/smart-menu/index.tsx
index 2ff87cd..e913046 100644
--- a/client/src/components/smart-menu/index.tsx
+++ b/client/src/components/smart-menu/index.tsx
@@ -65,7 +65,6 @@ const SmartMenu: FC = ({ currentMenu, menu }) => {
const [menuName, setMenuName] = useState('');
const { width } = useWindowSize();
const query = useQuery();
- console.log(currentMenu, menuName, menu);
useEffect(() => {
setOpenStatus(false);
}, [query]);
From c14d67f5c0f3fb0bafc6b86b5aede24181ef5d32 Mon Sep 17 00:00:00 2001
From: yoonminsang
Date: Fri, 20 Aug 2021 04:02:14 +0900
Subject: [PATCH 142/163] =?UTF-8?q?fix:=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/item/{items.tsx => item-list-wrapper.tsx} | 4 ++--
.../item/{main-items.tsx => main-item-wrapper.tsx} | 4 ++--
.../{items-container.tsx => item-list-container.tsx} | 8 ++++----
client/src/containers/main-item-container.tsx | 9 +++++++--
client/src/pages/item-list-page.tsx | 4 ++--
5 files changed, 17 insertions(+), 12 deletions(-)
rename client/src/components/item/{items.tsx => item-list-wrapper.tsx} (89%)
rename client/src/components/item/{main-items.tsx => main-item-wrapper.tsx} (89%)
rename client/src/containers/{items-container.tsx => item-list-container.tsx} (75%)
diff --git a/client/src/components/item/items.tsx b/client/src/components/item/item-list-wrapper.tsx
similarity index 89%
rename from client/src/components/item/items.tsx
rename to client/src/components/item/item-list-wrapper.tsx
index b3a45f5..5987e96 100644
--- a/client/src/components/item/items.tsx
+++ b/client/src/components/item/item-list-wrapper.tsx
@@ -33,7 +33,7 @@ const SmallTitle = styled.div`
}
`;
-const Items: FC = ({ items, loading }) => {
+const ItemListWrapper: FC = ({ items, loading }) => {
return (
{loading &&
로딩중
}
@@ -43,4 +43,4 @@ const Items: FC
= ({ items, loading }) => {
);
};
-export default Items;
+export default ItemListWrapper;
diff --git a/client/src/components/item/main-items.tsx b/client/src/components/item/main-item-wrapper.tsx
similarity index 89%
rename from client/src/components/item/main-items.tsx
rename to client/src/components/item/main-item-wrapper.tsx
index f732e52..4b65a83 100644
--- a/client/src/components/item/main-items.tsx
+++ b/client/src/components/item/main-item-wrapper.tsx
@@ -35,7 +35,7 @@ const SmallTitle = styled.div`
}
`;
-const MainItems: FC = ({ popularItems, newItems, recommendItems, loading }) => {
+const MainItemWrapper: FC = ({ popularItems, newItems, recommendItems, loading }) => {
return (
{loading &&
로딩중
}
@@ -49,4 +49,4 @@ const MainItems: FC
= ({ popularItems, newItems, recommendItems,
);
};
-export default MainItems;
+export default MainItemWrapper;
diff --git a/client/src/containers/items-container.tsx b/client/src/containers/item-list-container.tsx
similarity index 75%
rename from client/src/containers/items-container.tsx
rename to client/src/containers/item-list-container.tsx
index 5c81e35..5aff7e7 100644
--- a/client/src/containers/items-container.tsx
+++ b/client/src/containers/item-list-container.tsx
@@ -1,11 +1,11 @@
import React, { FC, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
-import Items from 'components/item/items';
+import ItemListWrapper from 'components/item/item-list-wrapper';
import { useQuery } from 'lib/router';
import { getItems } from 'store/items';
-const ItemsContainer: FC = () => {
+const ItemListContainer: FC = () => {
const { items, loading } = useSelector(({ items, loading }: RootState) => ({
items: items.items,
loading: loading['items/getItems'],
@@ -16,7 +16,7 @@ const ItemsContainer: FC = () => {
const { categoryId, pageId, type, search } = query;
dispatch({ type: getItems.type, payload: { categoryId, pageId, type, search } });
}, [query, dispatch]);
- return ;
+ return ;
};
-export default ItemsContainer;
+export default ItemListContainer;
diff --git a/client/src/containers/main-item-container.tsx b/client/src/containers/main-item-container.tsx
index a8836ef..60c37ef 100644
--- a/client/src/containers/main-item-container.tsx
+++ b/client/src/containers/main-item-container.tsx
@@ -2,7 +2,7 @@ import React, { FC, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { RootState } from 'store';
import { getMainItems } from 'store/items';
-import MainItems from 'components/item/main-items';
+import MainItemWrapper from 'components/item/main-item-wrapper';
const MainItemContainer: FC = () => {
const { popularItems, newItems, recommendItems, loading } = useSelector(({ items, loading }: RootState) => ({
@@ -16,7 +16,12 @@ const MainItemContainer: FC = () => {
dispatch({ type: getMainItems.type });
}, [dispatch]);
return (
-
+
);
};
diff --git a/client/src/pages/item-list-page.tsx b/client/src/pages/item-list-page.tsx
index a5405ea..c405c52 100644
--- a/client/src/pages/item-list-page.tsx
+++ b/client/src/pages/item-list-page.tsx
@@ -5,7 +5,7 @@ import HeaderContainer from 'containers/header-container';
import { Layout, Footer } from 'components';
import { useQuery } from 'lib/router';
import SearchContainer from 'containers/search-container';
-import ItemsContainer from 'containers/items-container';
+import ItemListContainer from 'containers/item-list-container';
const ItemListPage = (): ReactElement => {
const query = useQuery();
@@ -18,7 +18,7 @@ const ItemListPage = (): ReactElement => {
-
+
From 402f6bc0f384c4a78a01a08a82d56f0af3ae7b87 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Thu, 19 Aug 2021 11:21:14 +0900
Subject: [PATCH 143/163] =?UTF-8?q?refactor:=20=EB=A0=88=EC=9D=B4=EC=95=84?=
=?UTF-8?q?=EC=9B=83=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Layout 컴포넌트에서 Navbar 컴포넌트 분리
- test 코드 수정
- HeaderContainer -> NavbarContainer
---
.../common/__test__/footer.test.tsx | 15 ------
.../common/__test__/header.test.tsx | 25 ----------
.../common/__test__/layout.test.tsx | 26 ++++++++--
.../common/__test__/navbar.test.tsx | 4 +-
.../components/common/{ => layout}/footer.tsx | 0
.../components/common/{ => layout}/header.tsx | 16 ++----
client/src/components/common/layout/index.tsx | 49 +++++++++++++++++++
client/src/components/common/navbar.tsx | 10 ++--
client/src/components/index.ts | 2 -
...der-container.tsx => navbar-container.tsx} | 5 +-
client/src/pages/item-detail-page.tsx | 15 +++---
client/src/pages/login-page.tsx | 19 +++----
client/src/pages/main-page.tsx | 15 +++---
client/src/pages/not-found-page.tsx | 15 +++---
client/src/pages/signup-page.tsx | 15 +++---
15 files changed, 121 insertions(+), 110 deletions(-)
delete mode 100644 client/src/components/common/__test__/footer.test.tsx
delete mode 100644 client/src/components/common/__test__/header.test.tsx
rename client/src/components/common/{ => layout}/footer.tsx (100%)
rename client/src/components/common/{ => layout}/header.tsx (75%)
create mode 100644 client/src/components/common/layout/index.tsx
rename client/src/containers/{header-container.tsx => navbar-container.tsx} (90%)
diff --git a/client/src/components/common/__test__/footer.test.tsx b/client/src/components/common/__test__/footer.test.tsx
deleted file mode 100644
index 3de8a0b..0000000
--- a/client/src/components/common/__test__/footer.test.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-import { render } from '@testing-library/react';
-import Footer from '../footer';
-
-describe('', () => {
- it('matches snapshot', () => {
- const { container } = render();
- expect(container).toMatchSnapshot();
- });
-
- it('matches snapshot mobile', () => {
- const { container } = render();
- expect(container).toMatchSnapshot();
- });
-});
diff --git a/client/src/components/common/__test__/header.test.tsx b/client/src/components/common/__test__/header.test.tsx
deleted file mode 100644
index 6a85589..0000000
--- a/client/src/components/common/__test__/header.test.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { render } from '@testing-library/react';
-import Header from '../header';
-
-describe('', () => {
- it('matches snapshot pc main', () => {
- const { container } = render( null} />);
- expect(container).toMatchSnapshot();
- });
-
- it('matches snapshot pc', () => {
- const { container } = render( null} />);
- expect(container).toMatchSnapshot();
- });
-
- it('matches snapshot mobile main', () => {
- const { container } = render( null} />);
- expect(container).toMatchSnapshot();
- });
-
- it('matches snapshot mobile', () => {
- const { container } = render( null} />);
- expect(container).toMatchSnapshot();
- });
-});
diff --git a/client/src/components/common/__test__/layout.test.tsx b/client/src/components/common/__test__/layout.test.tsx
index db23968..59b6c49 100644
--- a/client/src/components/common/__test__/layout.test.tsx
+++ b/client/src/components/common/__test__/layout.test.tsx
@@ -3,13 +3,31 @@ import { render } from '@testing-library/react';
import Layout from '../layout';
describe('', () => {
- it('matches snapshot', () => {
- const { container } = render(test layout);
+ it('matches snapshot pc main', () => {
+ const { container } = render(
+
+ test layout main
+ ,
+ );
expect(container).toMatchSnapshot();
});
- it('matches snapshot main', () => {
- const { container } = render(test layout main);
+ it('matches snapshot pc', () => {
+ const { container } = render(test layout);
+ expect(container).toMatchSnapshot();
+ });
+
+ it('matches snapshot mobile main', () => {
+ const { container } = render(
+
+ test layout mobile
+ ,
+ );
+ expect(container).toMatchSnapshot();
+ });
+
+ it('matches snapshot mobile', () => {
+ const { container } = render(test layout mobile);
expect(container).toMatchSnapshot();
});
});
diff --git a/client/src/components/common/__test__/navbar.test.tsx b/client/src/components/common/__test__/navbar.test.tsx
index dd183db..a7e07bf 100644
--- a/client/src/components/common/__test__/navbar.test.tsx
+++ b/client/src/components/common/__test__/navbar.test.tsx
@@ -4,12 +4,12 @@ import Navbar from '../navbar';
describe('', () => {
it('matches snapshot', () => {
- const { container } = render( null} />);
+ const { container } = render( null} />);
expect(container).toMatchSnapshot();
});
it('matches snapshot mobile', () => {
- const { container } = render( null} />);
+ const { container } = render( null} />);
expect(container).toMatchSnapshot();
});
});
diff --git a/client/src/components/common/footer.tsx b/client/src/components/common/layout/footer.tsx
similarity index 100%
rename from client/src/components/common/footer.tsx
rename to client/src/components/common/layout/footer.tsx
diff --git a/client/src/components/common/header.tsx b/client/src/components/common/layout/header.tsx
similarity index 75%
rename from client/src/components/common/header.tsx
rename to client/src/components/common/layout/header.tsx
index a0150d1..45a37d9 100644
--- a/client/src/components/common/header.tsx
+++ b/client/src/components/common/layout/header.tsx
@@ -1,16 +1,13 @@
import React, { FC } from 'react';
import styled from 'lib/woowahan-components';
import { Link } from 'lib/router';
-import { Logo, Navbar } from 'components';
-import { MAIN_URL } from 'constants/urls';
+import { Logo } from 'components';
import BrickBg from 'assets/images/brick.png';
import TentBg from 'assets/images/tent.png';
interface HeaderProps {
displayMain: boolean;
isMobile: boolean;
- userId: string | null | undefined;
- onLogout: () => void;
}
const Wrapper = styled.header`
@@ -46,7 +43,7 @@ const LogoWrapper = styled.div`
padding: 25px 0;
`;
-const Header: FC = ({ displayMain, isMobile, userId, onLogout }) => {
+const Header: FC = ({ displayMain, isMobile }) => {
const renderLogo = () => {
if (isMobile) {
if (displayMain) return ;
@@ -64,19 +61,14 @@ const Header: FC = ({ displayMain, isMobile, userId, onLogout }) =>
}
return (
-
+
);
};
- return (
-
-
- {renderLogo()}
-
- );
+ return {renderLogo()};
};
export default Header;
diff --git a/client/src/components/common/layout/index.tsx b/client/src/components/common/layout/index.tsx
new file mode 100644
index 0000000..5af1631
--- /dev/null
+++ b/client/src/components/common/layout/index.tsx
@@ -0,0 +1,49 @@
+import React, { FC } from 'react';
+import woowahan from 'lib/woowahan-components';
+import Header from './header';
+import Footer from './footer';
+
+interface LayoutProps {
+ displayMain?: boolean;
+ isMobile: boolean;
+}
+
+const Wrapper = woowahan.div`
+ min-height: 100%;
+ background-color: ${props => props.theme?.colorBg};
+ display: flex;
+ flex-direction: column;
+
+ main {
+ flex: 1;
+ padding: 0 10%;
+ display: flex;
+ justify-content: center;
+ }
+
+ ${props => props.theme?.mobile} {
+ main {
+ padding: 0 12px;
+ }
+ }
+
+ ${props => props.theme?.laptop} {
+ align-items: center;
+ main {
+ padding: 0;
+ width: 1000px;
+ }
+ }
+`;
+
+const Layout: FC = ({ children, displayMain = false, isMobile }) => {
+ return (
+
+
+ {children}
+
+
+ );
+};
+
+export default Layout;
diff --git a/client/src/components/common/navbar.tsx b/client/src/components/common/navbar.tsx
index fc69d38..97dfa0a 100644
--- a/client/src/components/common/navbar.tsx
+++ b/client/src/components/common/navbar.tsx
@@ -10,8 +10,8 @@ import logoutIcon from 'assets/icons/logout.png';
import loginIcon from 'assets/icons/login.png';
interface NavbarProps {
- white?: boolean;
- mobile?: boolean;
+ displayMain: boolean;
+ isMobile: boolean;
userId: string | null | undefined;
onLogout: () => void;
}
@@ -56,9 +56,9 @@ const Wrapper = styled.nav`
}
`;
-const Navbar: FC = ({ white = false, mobile = false, userId, onLogout }) => {
+const Navbar: FC = ({ displayMain, isMobile, userId, onLogout }) => {
return (
-
+
{mobile && (
@@ -75,7 +75,7 @@ const Navbar: FC = ({ white = false, mobile = false, userId, onLogo
{userId ? (
) : (
diff --git a/client/src/components/index.ts b/client/src/components/index.ts
index 37de4d1..f8337d4 100644
--- a/client/src/components/index.ts
+++ b/client/src/components/index.ts
@@ -1,7 +1,5 @@
export { default as Logo } from './common/logo';
export { default as Layout } from './common/layout';
-export { default as Header } from './common/header';
-export { default as Footer } from './common/footer';
export { default as Navbar } from './common/navbar';
export { default as Modal } from './common/modal';
diff --git a/client/src/containers/header-container.tsx b/client/src/containers/navbar-container.tsx
similarity index 90%
rename from client/src/containers/header-container.tsx
rename to client/src/containers/navbar-container.tsx
index 4a0fda1..937f959 100644
--- a/client/src/containers/header-container.tsx
+++ b/client/src/containers/navbar-container.tsx
@@ -2,8 +2,8 @@ import React, { FC, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { RootState } from 'store';
import { logout } from 'store/auth';
-import { Header } from 'components';
import { IUser } from 'types/auth';
+import { Navbar } from 'components';
import AuthLogoutModal from 'components/auth/logout-modal';
interface HeaderProps {
@@ -28,9 +28,10 @@ const HeaderContainer: FC = ({ displayMain = false, isMobile }) =>
setModal(false);
dispatch({ type: logout.type });
};
+
return (
<>
-
+
{modal && }
>
);
diff --git a/client/src/pages/item-detail-page.tsx b/client/src/pages/item-detail-page.tsx
index c641908..ee2dd4e 100644
--- a/client/src/pages/item-detail-page.tsx
+++ b/client/src/pages/item-detail-page.tsx
@@ -1,22 +1,21 @@
import React, { ReactElement } from 'react';
import useWindowSize from 'hooks/use-window-size';
+import NavbarContainer from 'containers/navbar-container';
import SmartMenuContainer from 'containers/smart-menu-container';
-import HeaderContainer from 'containers/header-container';
-import { Layout, Footer } from 'components';
+import { Layout } from 'components';
const ItemDetailPage = (): ReactElement => {
const { width } = useWindowSize();
const isMobile = width <= 480;
return (
-
-
-
+ <>
+
+
여기는 아이템 디테일 페이지
-
-
-
+
+ >
);
};
diff --git a/client/src/pages/login-page.tsx b/client/src/pages/login-page.tsx
index 5399a66..7fcf4da 100644
--- a/client/src/pages/login-page.tsx
+++ b/client/src/pages/login-page.tsx
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react';
import woowahan from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
+import NavbarContainer from 'containers/navbar-container';
import LoginContainer from 'containers/login-container';
-import HeaderContainer from 'containers/header-container';
-import { Layout, Footer } from 'components';
+import { Layout } from 'components';
const Div = woowahan.div`
display: flex;
@@ -17,15 +17,12 @@ const LoginPage = (): ReactElement => {
const isMobile = width <= 480;
return (
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+
+ >
);
};
diff --git a/client/src/pages/main-page.tsx b/client/src/pages/main-page.tsx
index 3c759eb..acd0e3e 100644
--- a/client/src/pages/main-page.tsx
+++ b/client/src/pages/main-page.tsx
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react';
import useWindowSize from 'hooks/use-window-size';
+import NavbarContainer from 'containers/navbar-container';
import SmartMenuContainer from 'containers/smart-menu-container';
-import HeaderContainer from 'containers/header-container';
import MainItemContainer from 'containers/main-item-container';
-import { Layout, Footer } from 'components';
+import { Layout } from 'components';
import SearchContainer from 'containers/search-container';
const MainPage = (): ReactElement => {
@@ -11,15 +11,14 @@ const MainPage = (): ReactElement => {
const isMobile = width <= 480;
return (
-
-
-
+ <>
+
+
-
-
-
+
+ >
);
};
diff --git a/client/src/pages/not-found-page.tsx b/client/src/pages/not-found-page.tsx
index deb77cf..38ca105 100644
--- a/client/src/pages/not-found-page.tsx
+++ b/client/src/pages/not-found-page.tsx
@@ -1,8 +1,8 @@
import React, { ReactElement } from 'react';
import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
-import HeaderContainer from 'containers/header-container';
-import { Layout, Footer } from 'components';
+import NavbarContainer from 'containers/navbar-container';
+import { Layout } from 'components';
const Text = styled.div`
flex: 1;
@@ -40,16 +40,15 @@ const NotFoundPage = (): ReactElement => {
const isMobile = width <= 480;
return (
-
-
-
+ <>
+
+
404
낫 파운드
-
-
-
+
+ >
);
};
diff --git a/client/src/pages/signup-page.tsx b/client/src/pages/signup-page.tsx
index 6ba2f72..8fcd126 100644
--- a/client/src/pages/signup-page.tsx
+++ b/client/src/pages/signup-page.tsx
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react';
import styled from 'lib/woowahan-components';
import useWindowSize from 'hooks/use-window-size';
+import NavbarContainer from 'containers/navbar-container';
import SignupContainer from 'containers/signup-container';
-import HeaderContainer from 'containers/header-container';
-import { Layout, Footer } from 'components';
+import { Layout } from 'components';
const Div = styled.div`
display: flex;
@@ -17,15 +17,14 @@ const SignupPage = (): ReactElement => {
const isMobile = width <= 480;
return (
-
-
-
+ <>
+
+
-
-
-
+
+ >
);
};
From 5b40359411593dd208555ede1ac3c8dc218797f5 Mon Sep 17 00:00:00 2001
From: Seogeurim
Date: Thu, 19 Aug 2021 15:50:16 +0900
Subject: [PATCH 144/163] =?UTF-8?q?refactor:=20=EB=AA=A8=EB=8B=AC=20?=
=?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 모달에 visible props로 받기
- 배경을 클릭했을 때 모달이 닫히도록 설정
- 네브바 버튼에 cursor pointer 설정
---
client/src/components/auth/logout-modal.tsx | 20 ++++++++-------
client/src/components/auth/success-modal.tsx | 8 ++++--
client/src/components/common/modal.tsx | 27 +++++++++++++++-----
client/src/components/common/navbar.tsx | 1 +
client/src/containers/navbar-container.tsx | 13 ++++------
client/src/containers/signup-container.tsx | 8 +++---
6 files changed, 48 insertions(+), 29 deletions(-)
diff --git a/client/src/components/auth/logout-modal.tsx b/client/src/components/auth/logout-modal.tsx
index aa44441..fed2fe5 100644
--- a/client/src/components/auth/logout-modal.tsx
+++ b/client/src/components/auth/logout-modal.tsx
@@ -1,19 +1,20 @@
-import React, { FC } from 'react';
+import React, { FC, Dispatch, SetStateAction } from 'react';
import styled from 'lib/woowahan-components';
import { Modal } from 'components';
+interface LogoutModalProps {
+ visible: boolean;
+ setVisible: Dispatch>;
+ onConfirm: () => void;
+}
+
const Title = styled.h2`
span {
color: ${props => props.theme?.colorPrimary};
}
`;
-interface LogoutModalProps {
- onCancel: () => void;
- onConfirm: () => void;
-}
-
-const AuthLogoutModal: FC = ({ onCancel, onConfirm }) => {
+const LogoutModal: FC = ({ visible, setVisible, onConfirm }) => {
return (
= ({ onCancel, onConfirm }) => {
}
body={나중에 꼭 다시 로그인하러 오세요~
}
- onCancel={onCancel}
+ visible={visible}
+ setVisible={setVisible}
onConfirm={onConfirm}
/>
);
};
-export default AuthLogoutModal;
+export default LogoutModal;
diff --git a/client/src/components/auth/success-modal.tsx b/client/src/components/auth/success-modal.tsx
index 484ba86..d953090 100644
--- a/client/src/components/auth/success-modal.tsx
+++ b/client/src/components/auth/success-modal.tsx
@@ -1,10 +1,12 @@
-import React, { FC } from 'react';
+import React, { FC, Dispatch, SetStateAction } from 'react';
import styled from 'lib/woowahan-components';
import { Modal } from 'components';
import { IUserId } from 'types/auth';
interface AuthSuccessModalProps {
userId: IUserId;
+ visible: boolean;
+ setVisible: Dispatch>;
}
const Title = styled.h2`
@@ -26,7 +28,7 @@ const Info = styled.div`
}
`;
-const AuthSuccessModal: FC = ({ userId }) => {
+const AuthSuccessModal: FC = ({ userId, visible, setVisible }) => {
return (
= ({ userId }) => {
알차고 실속있는 서비스로 찾아뵙겠습니다.
}
+ visible={visible}
+ setVisible={setVisible}
/>
);
};
diff --git a/client/src/components/common/modal.tsx b/client/src/components/common/modal.tsx
index 21f207c..c3d2e38 100644
--- a/client/src/components/common/modal.tsx
+++ b/client/src/components/common/modal.tsx
@@ -1,4 +1,4 @@
-import React, { FC, ReactNode } from 'react';
+import React, { FC, ReactNode, Dispatch, SetStateAction } from 'react';
import styled from 'lib/woowahan-components';
import alertImg from 'assets/icons/congrats.gif';
@@ -8,6 +8,8 @@ interface ModalProps {
type: 'alert' | 'confirm';
header?: ReactNode;
body?: ReactNode;
+ visible: boolean;
+ setVisible: Dispatch>;
onCancel?: () => void;
onConfirm?: () => void;
}
@@ -19,7 +21,7 @@ const ModalBlock = styled.div`
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
- display: flex;
+ display: ${props => (props.visible ? 'flex' : 'none')};
flex-direction: column;
justify-content: center;
align-items: center;
@@ -133,9 +135,22 @@ const ModalFooter = styled.div`
}
`;
-const Modal: FC = ({ type, header, body, onCancel, onConfirm }) => {
+const Modal: FC = ({ type, header, body, visible, setVisible, onCancel, onConfirm }) => {
+ const closeModal = () => {
+ setVisible(false);
+ };
+
+ const modalClickHandler = (e: Event) => {
+ if (e.target === e.currentTarget) closeModal();
+ };
+
+ const confirmHandler = () => {
+ closeModal();
+ if (onConfirm) onConfirm();
+ };
+
return (
-
+