Skip to content

Commit

Permalink
Merge pull request #118 from Team-Lecue/feature/createBook
Browse files Browse the repository at this point in the history
[CreateBook] dev 머지 PR입니다!
  • Loading branch information
jungwoo3490 authored Jan 16, 2024
2 parents 719190e + 3499a93 commit 70cc1fb
Show file tree
Hide file tree
Showing 20 changed files with 458 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import styled from '@emotion/styled';

export const BookInfoWrapper = styled.section`
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
margin-top: 1.2rem;
`;

export const TextareaContainer = styled.div<{ isEmpty: boolean }>`
width: 100%;
height: 15rem;
padding: 1.7rem 2rem 4rem;
${({ theme }) => theme.fonts.Body3_R_14};
border: 0.1rem solid
${({ theme, isEmpty }) => (isEmpty ? theme.colors.LG : theme.colors.BG)};
border-radius: 0.8rem;
background-color: ${({ theme }) => theme.colors.white};
`;

export const Textarea = styled.textarea`
width: 100%;
height: 100%;
border: none;
color: ${({ theme }) => theme.colors.BG};
${({ theme }) => theme.fonts.Body2_M_14};
resize: none;
&:focus {
outline: none;
}
`;

export const WordCount = styled.p`
display: flex;
justify-content: flex-end;
width: 100%;
color: ${({ theme }) => theme.colors.WG};
${({ theme }) => theme.fonts.E_Body2_R_14};
`;
31 changes: 31 additions & 0 deletions src/CreateBook/components/BookInfoTextarea/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as S from './BookInfoTextarea.style';

interface BookInfoTextareaProps {
description: string;
changeDescription: (description: string) => void;
}

function BookInfoTextarea({
description,
changeDescription,
}: BookInfoTextareaProps) {
const handleChangeInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
if (e.target.value.length <= 85) {
changeDescription(e.target.value);
}
};
return (
<S.BookInfoWrapper>
<S.TextareaContainer isEmpty={description.length === 0}>
<S.Textarea
placeholder="무엇에 대한 레큐북인가요?"
value={description}
onChange={handleChangeInput}
/>
<S.WordCount>({description.length}/85)</S.WordCount>
</S.TextareaContainer>
</S.BookInfoWrapper>
);
}

export default BookInfoTextarea;
38 changes: 38 additions & 0 deletions src/CreateBook/components/BookInput/BookInput.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import styled from '@emotion/styled';

export const TitleWrapper = styled.section`
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
margin-top: 1.2rem;
`;

export const InputContainer = styled.div<{ isEmpty: boolean }>`
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 1.55rem 2rem;
${({ theme }) => theme.fonts.Body3_R_14};
border: 0.1rem solid
${({ theme, isEmpty }) => (isEmpty ? theme.colors.LG : theme.colors.BG)};
border-radius: 0.8rem;
background-color: ${({ theme }) => theme.colors.white};
`;

export const Input = styled.input`
width: 100%;
color: ${({ theme }) => theme.colors.BG};
${({ theme }) => theme.fonts.Body2_M_14};
`;

export const WordCount = styled.p`
color: ${({ theme }) => theme.colors.WG};
${({ theme }) => theme.fonts.E_Body2_R_14};
`;
29 changes: 29 additions & 0 deletions src/CreateBook/components/BookInput/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as S from './BookInput.style';

interface BookInputProps {
title: string;
changeTitle: (title: string) => void;
}

function BookInput({ title, changeTitle }: BookInputProps) {
const handleChangeInput = (e: React.ChangeEvent<HTMLInputElement>) => {
if (e.target.value.length <= 15) {
changeTitle(e.target.value);
}
};
return (
<S.TitleWrapper>
<S.InputContainer isEmpty={title.length === 0}>
<S.Input
type="text"
placeholder="레큐북의 제목을 입력해주세요"
value={title}
onChange={handleChangeInput}
/>
<S.WordCount>({title.length}/15)</S.WordCount>
</S.InputContainer>
</S.TitleWrapper>
);
}

export default BookInput;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import styled from '@emotion/styled';

export const CompleteButtonWrapper = styled.div`
width: 100%;
margin-bottom: 2rem;
`;
19 changes: 19 additions & 0 deletions src/CreateBook/components/CompleteButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Button from '../../../components/common/Button';
import * as S from './CompleteButton.style';

interface CompleteButtonProps {
isActive: boolean;
onClick: () => void;
}

function CompleteButton({ isActive, onClick }: CompleteButtonProps) {
return (
<S.CompleteButtonWrapper>
<Button variant="complete" disabled={!isActive} onClick={onClick}>
완료
</Button>
</S.CompleteButtonWrapper>
);
}

export default CompleteButton;
13 changes: 13 additions & 0 deletions src/CreateBook/components/SelectColor/SelectColor.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from '@emotion/styled';

export const Wrapper = styled.article`
display: flex;
gap: 1.6rem;
flex-direction: column;
`;
export const Category = styled.p`
display: flex;
${({ theme }) => theme.colors.BG};
${({ theme }) => theme.fonts.Title1_SB_16};
`;
26 changes: 26 additions & 0 deletions src/CreateBook/components/SelectColor/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import ShowColorChart from '../ShowColorChart';
import * as S from './SelectColor.style';

interface SelectColorProps {
backgroundColor: string;
clickBackgroundColor: (backgroundColor: string) => void;
}

function SelectColor({
backgroundColor,
clickBackgroundColor,
}: SelectColorProps) {
return (
<S.Wrapper>
<S.Category>레큐북 배경색</S.Category>
<ShowColorChart
backgroundColor={backgroundColor}
handleFn={(backgroundColor: string) =>
clickBackgroundColor(backgroundColor)
}
/>
</S.Wrapper>
);
}

export default SelectColor;
49 changes: 49 additions & 0 deletions src/CreateBook/components/ShowColorChart/ShowColorChart.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';

export const Wrapper = styled.div`
display: flex;
gap: 1.4rem;
justify-content: flex-start;
align-items: center;
padding: 0.5rem 0.1rem 0.7rem 0.3rem;
overflow-x: scroll;
`;

export const ColorWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
width: 3.8rem;
height: 3.8rem;
`;

export const Color = styled.button<{ $colorCode: string; variant: boolean }>`
border-radius: 3rem;
${({ $colorCode, theme }) =>
$colorCode === '#F5F5F5' &&
css`
outline: 0.1rem solid ${theme.colors.WG};
`};
background-color: ${({ $colorCode }) => $colorCode};
${({ variant, theme }) =>
variant
? css`
width: 3.8rem;
height: 3.8rem;
border: 0.4rem solid ${theme.colors.white};
outline: 0.1rem solid ${theme.colors.WG};
`
: css`
width: 3rem;
height: 3rem;
border: none;
`};
`;
31 changes: 31 additions & 0 deletions src/CreateBook/components/ShowColorChart/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as S from './ShowColorChart.style';

interface ShowColorChartProps {
backgroundColor: string;
handleFn: (backgroundColor: string) => void;
}

function ShowColorChart({ backgroundColor, handleFn }: ShowColorChartProps) {
return (
<S.Wrapper>
<S.ColorWrapper>
<S.Color
type="button"
$colorCode={'#191919'}
onClick={() => handleFn('#191919')}
variant={backgroundColor === '#191919'}
></S.Color>
</S.ColorWrapper>
<S.ColorWrapper>
<S.Color
type="button"
$colorCode={'#F5F5F5'}
onClick={() => handleFn('#F5F5F5')}
variant={backgroundColor === '#F5F5F5'}
></S.Color>
</S.ColorWrapper>
</S.Wrapper>
);
}

export default ShowColorChart;
Empty file.
Empty file added src/CreateBook/hooks/.gitkeep
Empty file.
40 changes: 40 additions & 0 deletions src/CreateBook/page/CreateBook.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import styled from '@emotion/styled';

export const CreateBookWrapper = styled.section`
display: flex;
flex-direction: column;
width: 100vw;
height: 100dvh;
`;

export const CreateBookBodyWrapper = styled.div`
display: flex;
justify-content: space-between;
flex-direction: column;
width: 100%;
height: calc(100vh - 5.4rem);
padding: 0 1.6rem;
margin-top: 5.4rem;
`;

export const InputWrapper = styled.div`
width: 100%;
`;

export const SectionTitle = styled.p`
color: ${({ theme }) => theme.colors.BG};
${({ theme }) => theme.fonts.Head2_SB_18};
`;

export const BookInputWrapper = styled.div`
width: 100%;
margin-top: 3rem;
`;

export const BookInfoTextareaWrapper = styled.div`
width: 100%;
margin: 4.4rem 0 2.63rem;
`;
Loading

0 comments on commit 70cc1fb

Please sign in to comment.