Skip to content

Commit

Permalink
refactor: 리뷰 보조 sort 상수로 관리하기(related to: #23)
Browse files Browse the repository at this point in the history
sort: 1 = RECOMMEND
sort: 2 = COMPLETE
  • Loading branch information
hyeonjin25 committed Aug 24, 2023
1 parent 1640b2e commit 00b9d00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/ReviewAssistant/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Fonts } from '@/utils/GlobalFonts';
import { colors } from '@/utils/GlobalStyles';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { keyframes, styled } from 'styled-components';
import { ReactComponent as AIBot } from '@/assets/icons/aibot.svg';
import { Row } from '@/ui/flex/flex';
import Dot from '@/assets/icons/dot.svg';
import { Margin } from '@/ui/margin/margin';
import { CommentType } from '@/types/Comments';
import { COMPLETE, RECOMMEND } from '@/config/constants';

interface Props {
comments: CommentType[];
Expand Down Expand Up @@ -77,13 +78,13 @@ const Comment = ({
sentenceComplete: (idx1: number, idx2: number, replace: string) => void;
}) => {
let title;
if (sort == 1) title = '주제 추천';
if (sort == 2) title = '이 문장을 쓰려고 하셨나요?';
if (sort == RECOMMEND) title = '주제 추천';
if (sort == COMPLETE) title = '이 문장을 쓰려고 하셨나요?';
return (
<CommentBox
index={index}
sort={sort}
disabled={sort == 1 ? true : false}
disabled={sort == RECOMMEND ? true : false}
onClick={() => {
if (idx) sentenceComplete(idx[0], idx[1], content);
}}
Expand Down Expand Up @@ -136,19 +137,19 @@ const CommentBox = styled.button<{ index: number; sort: number }>`
display: flex;
flex-direction: column;
border-color: ${(props) =>
props.sort == 1
props.sort == RECOMMEND
? colors.gray06
: props.index == 1
? colors.red
: colors.primary};
border-width: ${(props) => (props.sort == 1 ? 1 : 2)}px;
border-width: ${(props) => (props.sort == RECOMMEND ? 1 : 2)}px;
border-radius: 5px;
border-style: solid;
border-radius: 5px;
padding: 16px 20px;
margin-top: 10px;
background-color: ${(props) =>
props.sort == 1
props.sort == RECOMMEND
? colors.white
: props.index == 1
? colors.lightRed
Expand Down
3 changes: 3 additions & 0 deletions src/config/constants.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// 리뷰 보조 sort
export const RECOMMEND = 1;
export const COMPLETE = 2;

0 comments on commit 00b9d00

Please sign in to comment.