Skip to content

Commit

Permalink
123 feat/일기 조회 페이지-메인 및 서브 감정 위젯 (#127)
Browse files Browse the repository at this point in the history
* feat : 일기상세 페이지 감정 위젯

* fix : 마진 높이 수정
  • Loading branch information
kangminguu authored Nov 4, 2024
1 parent a05bb9a commit 2d0d50e
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/widgets/show-main-emotion/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ShowMainEmotionContainer } from './ui/ShowMainEmotionContainer';
5 changes: 5 additions & 0 deletions src/widgets/show-main-emotion/model/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Emotions } from '@/shared/model/EmotionEnum';

export interface ShowMainEmotionContainerProps {
emotion: Emotions;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Meta, StoryObj } from '@storybook/react';
import { ShowMainEmotionContainer } from './ShowMainEmotionContainer';
import { Emotions } from '@/shared/model/EmotionEnum';

const meta: Meta<typeof ShowMainEmotionContainer> = {
title: 'Widgets/UI/ShowMainEmotionContainer',
component: ShowMainEmotionContainer,
tags: ['autodocs']
};

export default meta;
type Story = StoryObj<typeof ShowMainEmotionContainer>;

export const Default: Story = {
args: {
emotion: Emotions.Happy
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import styled from 'styled-components';

export const Container = styled.div`
// position: absolute;
// width: 100%;
height: 250px;
background-color: #ffffff;
border-radius: 10px;
padding: 30px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.13);
font-size: 16px;
font-weight: bold;
font-family: 'Pretendard', sans-serif;
`;

export const EmotionContainer = styled.div`
position: absolute;
display: flex;
height: 100px;
width: 70px;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #ffffff;
border-radius: 10px;
border: 1px solid rgba(0, 0, 0, 0.1);
padding: 20px;
left: 50%;
transform: translateX(-50%);
margin-top: 60px;
gap: 10px;
font-weight: normal;
`;
19 changes: 19 additions & 0 deletions src/widgets/show-main-emotion/ui/ShowMainEmotionContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Container, EmotionContainer } from './ShowMainEmotionContainer.styles';
import { ShowMainEmotionContainerProps } from '../model/type';
import { EmotionIcon } from '@/shared/EmotionIcon/ui/EmotionIcon';
import { getEmotionInfo } from '@/shared/model/EmotionEnum';

export const ShowMainEmotionContainer = ({
emotion
}: ShowMainEmotionContainerProps) => {
return (
<Container>
메인 감정 키워드
<EmotionContainer>
<EmotionIcon emotion={emotion} width="50px" height="50px" />
{getEmotionInfo(emotion).description}
</EmotionContainer>
</Container>
);
};
1 change: 1 addition & 0 deletions src/widgets/show-sub-emotion/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ShowSubEmotionContainer } from './ui/ShowSubEmotionContainer';
5 changes: 5 additions & 0 deletions src/widgets/show-sub-emotion/model/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Emotions } from '@/shared/model/EmotionEnum';

export interface ShowSubEmotionContainerProps {
subEmotions: Emotions[];
}
23 changes: 23 additions & 0 deletions src/widgets/show-sub-emotion/ui/ShowSubEmotionContainer.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Meta, StoryObj } from '@storybook/react';
import { ShowSubEmotionContainer } from './ShowSubEmotionContainer';
import { Emotions } from '@/shared/model/EmotionEnum';

const meta: Meta<typeof ShowSubEmotionContainer> = {
title: 'Widgets/UI/ShowSubEmotionContainer',
component: ShowSubEmotionContainer,
tags: ['autodocs']
};

export default meta;
type Story = StoryObj<typeof ShowSubEmotionContainer>;

export const Default: Story = {
args: {
subEmotions: [
Emotions.Angry,
Emotions.Sad,
Emotions.Blank,
Emotions.Excited
]
}
};
39 changes: 39 additions & 0 deletions src/widgets/show-sub-emotion/ui/ShowSubEmotionContainer.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import styled from 'styled-components';

export const Container = styled.div`
// position: absolute;
// width: 100%;
height: 250px;
background-color: #ffffff;
border-radius: 10px;
padding: 30px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.13);
font-size: 16px;
font-weight: bold;
font-family: 'Pretendard', sans-serif;
`;
export const EmotionsContainer = styled.div`
margin-top: 60px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
`;

export const EmotionContainer = styled.div`
display: flex;
height: 30px;
// width: 100px;
align-items: center;
justify-content: center;
background-color: #ffffff;
border-radius: 10px;
border: 1px solid rgba(0, 0, 0, 0.1);
padding: 10px 20px;
gap: 10px;
font-weight: normal;
font-size: 14px;
`;
33 changes: 33 additions & 0 deletions src/widgets/show-sub-emotion/ui/ShowSubEmotionContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import {
Container,
EmotionContainer,
EmotionsContainer
} from './ShowSubEmotionContainer.styled';
import { ShowSubEmotionContainerProps } from '../model/type';
import { EmotionIcon } from '@/shared/EmotionIcon/ui/EmotionIcon';
import { getEmotionInfo } from '@/shared/model/EmotionEnum';

export const ShowSubEmotionContainer = ({
subEmotions
}: ShowSubEmotionContainerProps) => {
return (
<Container>
서브 감정 키워드
<EmotionsContainer>
{subEmotions.map((emotion) => {
return (
<EmotionContainer>
<EmotionIcon
emotion={emotion}
width="25px"
height="25px"
/>
{getEmotionInfo(emotion).description}
</EmotionContainer>
);
})}
</EmotionsContainer>
</Container>
);
};

0 comments on commit 2d0d50e

Please sign in to comment.