Skip to content

Commit

Permalink
#8 style: 개인 대시보드 생성 css
Browse files Browse the repository at this point in the history
  • Loading branch information
MyungJiwoo committed Aug 8, 2024
1 parent a270858 commit c14b654
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 2 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
"framer-motion": "^11.3.8",
"gsap": "^3.12.5",
"react": "^18.3.1",
"react-autosize-textarea": "^7.1.0",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1",
"react-router-dom": "^6.25.1",
"react-scripts": "5.0.1",
"react-textarea-autosize": "^8.5.3",
"simplex-noise": "^4.0.2",
"styled-components": "^6.1.12",
"styled-reset": "^4.5.2",
Expand Down
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import MainPage from './pages/MainPage';
import LoginPage from './pages/LoginPage';
import CreateBoard from './pages/CreateBoardPage';
import CreatePersonalBoard from './pages/CreatePersonalBoardPage';
import CreateTeamBoard from './pages/CreateTeamBoardPage';
import OAuthRedirectHandler from './contexts/OAuthRedirectHandler';
import { AuthProvider } from './contexts/AuthContext';

Expand All @@ -14,6 +16,8 @@ const App: React.FC = () => {
<Route path="/" Component={MainPage} />
<Route path="/login" Component={LoginPage} />
<Route path="/createBoard" Component={CreateBoard} />
<Route path="/createPersonalBoard" Component={CreatePersonalBoard} />
<Route path="/createTeamBoard" Component={CreateTeamBoard} />
<Route path="/api/oauth2/callback/:provider" element={<OAuthRedirectHandler />} />
</Routes>
</AuthProvider>
Expand Down
116 changes: 116 additions & 0 deletions src/pages/CreatePersonalBoardPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React, { useState } from 'react';
import Navbar from '../components/Navbar';
import Flex from '../components/Flex';

import { FaLock } from 'react-icons/fa';
import { FaEarthAsia } from 'react-icons/fa6';

import {
CreateDashBoardLayout,
CreateDashBoardContainer,
Title,
SubTitle,
CreateDashBoardModal,
SubmitBtn,
CreateForm,
Label,
Input,
Select,
RowWrapper,
Scope,
Textarea,
} from '../styles/CreateBoardPageStyled';

const CreatePersonalBoard: React.FC = () => {
const [selectedCategory, setSelectedCategory] = useState<string>(''); // 카테고리 설정
const [selectedScope, setSelectedScope] = useState<boolean>(false); // 공개범위 설정 (true=나만보기, false=전체공개)
const [inputIntroduction, setInputIntroduction] = useState<string | undefined>('');

// 카테고리 변경 함수
const handleChange = (event: { target: { value: React.SetStateAction<string> } }) => {
setSelectedCategory(event.target.value);
};

// 공개 범위 설정 함수
const handleScope = () => {
setSelectedScope(!selectedScope);
};

// 소개글 변경 함수
const handleIntroduction = (event: {
target: { value: React.SetStateAction<string | undefined> };
}) => {
setInputIntroduction(event?.target.value);
};

return (
<CreateDashBoardLayout>
<Navbar />
<CreateDashBoardContainer>
<CreateDashBoardModal>
<Title>개인 대시보드 생성</Title>
<SubTitle>제목과 설명, 카테고리를 설정하고 공개 여부를 선택하세요.</SubTitle>

<CreateForm>
<Flex>
<RowWrapper>
<Label>제목</Label>
<Input
type="text"
placeholder="대시보드 제목을 설정해주세요."
width="20rem"
></Input>
</RowWrapper>

<RowWrapper onClick={handleScope}>
{selectedScope ? (
<Scope>
<p>나만 보기</p>
<FaLock />
</Scope>
) : (
<Scope>
<p>전체 공개</p>
<FaEarthAsia />
</Scope>
)}
</RowWrapper>
</Flex>

<RowWrapper>
<Label>설명</Label>
<Textarea
placeholder="대시보드 설명을 설정해주세요."
maxLength={300}
value={inputIntroduction}
onChange={handleIntroduction}
/>
</RowWrapper>

<RowWrapper>
<Label>카테고리</Label>
<Select value={selectedCategory} onChange={handleChange}>
<option hidden selected>
(선택) 카테고리를 설정해주세요.
</option>
<option value="nothing">카테고리 없음</option>
<option value="userInput">직접 입력</option>
</Select>
{selectedCategory === 'userInput' ? (
<Input
type="text"
placeholder="카테고리 이름을 설정해주세요."
width="12.7rem"
></Input>
) : null}
</RowWrapper>
</CreateForm>

<SubmitBtn>대시보드 생성</SubmitBtn>
</CreateDashBoardModal>
</CreateDashBoardContainer>
</CreateDashBoardLayout>
);
};

export default CreatePersonalBoard;
120 changes: 120 additions & 0 deletions src/styles/CreateBoardPageStyled.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import styled from 'styled-components';
import theme from '../styles/Theme/Theme';
import TextareaAutosize, { TextareaAutosizeProps } from 'react-textarea-autosize';
interface StyledTextareaProps extends TextareaAutosizeProps {
width?: string;
}

export const CreateDashBoardLayout = styled.div`
width: 100vw;
Expand Down Expand Up @@ -41,6 +45,8 @@ export const CreateBoardWrapper = styled.div`
border-radius: 1rem;
border: 1px solid ${theme.color.stroke2};
box-shadow: ${theme.boxShadow.default};
cursor: pointer;
`;

export const PersonalIconImgWrapper = styled.div`
Expand Down Expand Up @@ -69,3 +75,117 @@ export const BoardTitle = styled.p`
font-weight: ${theme.font.weight.bold};
color: ${theme.color.text};
`;

/* 개인 대시보드 css */
export const CreateDashBoardModal = styled.div`
padding: 5rem;
border-radius: 1rem;
border: 1px solid ${theme.color.stroke2};
box-shadow: ${theme.boxShadow.default};
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`;

export const CreateForm = styled.form`
margin: 3rem;
display: flex;
flex-direction: column;
`;

export const RowWrapper = styled.div`
margin: 0.5rem 0;
display: flex;
align-items: center;
`;

export const Label = styled.label`
width: 5.2rem;
text-align: right;
margin-right: 1rem;
color: ${theme.color.black};
font-size: 1rem;
`;

export const Input = styled.input`
width: ${props => props.width};
padding: 0.5rem 1rem;
/* font-size: 1rem; */
border-radius: 0.3rem;
border: 1px solid ${theme.color.stroke2};
color: ${theme.color.black};
&:focus {
outline: none;
}
&::placeholder {
color: ${theme.color.lightGray};
}
`;

export const Scope = styled.div`
padding: 0.55rem 1rem;
margin-left: 1rem;
font-size: 0.8rem;
border-radius: 0.3rem;
border: 1px solid ${theme.color.stroke2};
color: ${theme.color.lightGray};
cursor: pointer;
display: flex;
p {
color: ${theme.color.gray};
margin-right: 0.2rem;
}
`;

export const Textarea = styled(TextareaAutosize)<StyledTextareaProps>`
width: 27.1rem;
min-width: 27.1rem;
max-width: 27.1rem;
min-height: 2rem;
padding: 0.55rem 1rem;
overflow-wrap: break-word;
word-break: break-all;
white-space: pre-wrap;
resize: none;
border-radius: 0.3rem;
border: 1px solid ${theme.color.stroke2};
&:focus {
outline: none;
}
&::placeholder {
color: ${theme.color.lightGray};
}
`;

export const Select = styled.select`
width: 14rem;
margin-right: 0.3rem;
padding: 0.44rem 1rem;
/* font-size: 1rem; */
border-radius: 0.3rem;
border: 1px solid ${theme.color.stroke2};
color: ${props => (props.value ? `${theme.color.black}` : `${theme.color.lightGray}`)};
&:focus {
outline: none;
}
`;

export const SubmitBtn = styled.button`
padding: 0.65rem 3rem;
border-radius: 0.625rem;
background: ${theme.color.gradation};
font-size: 1rem;
color: ${theme.color.white};
`;
Loading

0 comments on commit c14b654

Please sign in to comment.