Skip to content

Commit

Permalink
πŸ”€ :: (#147) class,notice mod UI
Browse files Browse the repository at this point in the history
πŸ”€ :: (#147) class,notice mod UI
  • Loading branch information
potatovllage authored Jun 10, 2022
2 parents 8129198 + aec82d1 commit 6c13178
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 28 deletions.
81 changes: 81 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
7 changes: 7 additions & 0 deletions src/assets/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/plus_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/components/challengeList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import fetcher from "@src/utils/function/fetcher";
import { ChallengeType } from "@src/utils/interfaces/challenge";
import React, { useState } from "react";
import useSWR from "swr";
import DefaultBox from "../common/defaultBox";
import Dropdown from "../common/dropdown";
import ChallengeCard from "./ChallengeCard";
import Link from "next/link";
import CreateBox from "../common/createBox";

const optionList = [
{
Expand All @@ -21,6 +21,8 @@ const optionList = [

const ChallengeList = () => {
const [option, setOption] = useState("true");
const [isHover, setIsHover] = useState<boolean>(false);

const { data, mutate } = useSWR(
"/challenges/web/lists?isProgress=true",
fetcher
Expand All @@ -41,7 +43,7 @@ const ChallengeList = () => {
<Title>
<div>진행 쀑인 μ±Œλ¦°μ§€</div>
<Dropdown
width={102}
width={108}
height={16}
selectedValue={option === "true" ? "진행쀑" : "μ™„λ£Œ"}
name='name'
Expand All @@ -57,9 +59,7 @@ const ChallengeList = () => {
</Title>
<ListBox>
<Link href='/challenge/create'>
<DefaultBox width={288} height={288}>
<PlusBtn>+</PlusBtn>
</DefaultBox>
<CreateBox width={288} height={288} />
</Link>
{data.challenge_list?.map((i: ChallengeType) => (
<ChallengeCard type={""} key={i.id} {...i} />
Expand Down
17 changes: 11 additions & 6 deletions src/components/class/seeClass/Class.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const ClassBanner = () => {
<BannerDiv2>
<TeacherDiv>
<img src={data.teacher.profile_image_url} alt='' />
<TeacherName>{data.teacher.name}</TeacherName>
<div>
<TeacherName>{data.teacher.name}</TeacherName>
</div>
<p>μ„ μƒλ‹˜</p>
</TeacherDiv>
<ClassCodeDiv>
Expand Down Expand Up @@ -168,12 +170,13 @@ const BannerDiv2 = styled.div`
`;

const TeacherDiv = styled.div`
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin-left: 54px;
> p {
width: 100%;
margin-right: 10px;
width: 50px;
color: ${({ theme }) => theme.color.white};
}
> img {
Expand All @@ -183,11 +186,13 @@ const TeacherDiv = styled.div`
}
`;

const TeacherName = styled.p`
width: 60px;
height: 30px;
const TeacherName = styled.h6`
width: 100%;
margin-right: 4px;
height: 30px;
font-size: 20px;
font-weight: normal;
color: ${({ theme }) => theme.color.white};
`;

const ClassCodeDiv = styled.div`
Expand Down
4 changes: 2 additions & 2 deletions src/components/class/seeClass/ClassStudentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const ClassStudentList: FC<Props> = ({ setClassInfo }) => {
padding='10px 16px'
isBoard={false}
/>
<ExcelDonwload onClick={excelDownload}>μ—‘μ…€λ‘œ λ³€ν™˜</ExcelDonwload>
<ExcelDonwload onClick={excelDownload}>μ—‘μ…€λ‘œ λ³€ν™˜ν•˜κΈ°</ExcelDonwload>
</Title>
<TypeMenuDiv>
<p style={{ gridColumn: "4/5" }}>평균 걸음 수</p>
Expand Down Expand Up @@ -158,7 +158,7 @@ const TypeMenuDiv = styled.div`
`;

const ExcelDonwload = styled.h6`
margin-left: 900px;
margin-left: 880px;
text-decoration: underline;
color: ${({ theme }) => theme.color.main};
font-size: 14px;
Expand Down
56 changes: 56 additions & 0 deletions src/components/common/createBox/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import styled from "@emotion/styled";
import React, { FC, useState } from "react";
import Image from "next/image";
import Plus from "../../../assets/plus.svg";
import Plus_White from "../../../assets/plus_white.svg";

interface Props {
width: number;
height: number;
}

const CreateBox: FC<Props> = props => {
const [isHover, setIsHover] = useState<boolean>(false);

return (
<>
<DefaultBoxStyle {...props}>
<PlusBtn
onMouseOver={() => setIsHover(true)}
onMouseOut={() => setIsHover(false)}
>
{props.children}
<Image
src={isHover ? Plus_White : Plus}
alt='plus'
width={50}
height={50}
/>
</PlusBtn>
</DefaultBoxStyle>
</>
);
};

export default CreateBox;

const DefaultBoxStyle = styled.div<{
width: number;
height: number;
}>`
width: ${({ width }) => `${width}px`};
height: ${({ height }) => `${height}px`};
border-radius: 12px;
border: 1px solid ${({ theme }) => theme.color.normal_gray};
display: flex;
flex-direction: column;
justify-content: space-between;
cursor: pointer;
`;

const PlusBtn = styled.div`
height: 100%;
display: flex;
justify-content: center;
align-items: center;
`;
19 changes: 11 additions & 8 deletions src/components/notice/MakeNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const MakeNotice: FC<Props & { mutate: KeyedMutator<any> }> = ({
scope: "",
});

const noticeSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
const noticeSubmit = async (e: React.MouseEvent<HTMLInputElement>) => {
e.preventDefault();
try {
await createNotice(
Expand All @@ -73,11 +73,9 @@ const MakeNotice: FC<Props & { mutate: KeyedMutator<any> }> = ({
case 400:
return ToastError("λͺ¨λ“  λΉˆμΉΈμ„ μ±„μ›Œμ£Όμ„Έμš”");
case 401:
return ToastError("인증에 μ‹€νŒ¨ν•˜μ˜€μŠ΅λ‹ˆλ‹€. ");
return ToastError("인증에 μ‹€νŒ¨ν•˜μ˜€μŠ΅λ‹ˆλ‹€.");
case 403:
return ToastError(
"κΆŒν•œμ΄ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 곡지사항 μž‘μ„±μ€ ROOT κΆŒν•œκ³Ό SUκΆŒν•œλ§Œ μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€."
);
return ToastError("κΆŒν•œμ΄ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.");
default:
return ToastError("κ΄€λ¦¬μžμ—κ²Œ λ¬Έμ˜ν•΄μ£Όμ„Έμš”.");
}
Expand Down Expand Up @@ -113,7 +111,7 @@ const MakeNotice: FC<Props & { mutate: KeyedMutator<any> }> = ({

return (
<>
<Wrapper onSubmit={noticeSubmit}>
<Wrapper>
<HeadDiv>
{isAuth ? (
<DropDown
Expand Down Expand Up @@ -167,14 +165,19 @@ const MakeNotice: FC<Props & { mutate: KeyedMutator<any> }> = ({
defaultColor={false}
value='μ·¨μ†Œ'
/>
<DefaultBtn type='submit' width={106} value='μž‘μ„±' />
<DefaultBtn
type='submit'
width={106}
value='μž‘μ„±'
onClick={noticeSubmit}
/>
</PostDiv>
</Wrapper>
</>
);
};

const Wrapper = styled.form`
const Wrapper = styled.div`
width: 100%;
padding: 40px 27px 40px 27px;
border-radius: 12px;
Expand Down
Loading

0 comments on commit 6c13178

Please sign in to comment.