Skip to content

Commit

Permalink
Feat: Chat-23-chatting (#6)
Browse files Browse the repository at this point in the history
* Feat: input, chatbox, aiν”„λ‘œν•„ UI μ»΄ν¬λ„ŒνŠΈ μ™„μ„±

* Feat: μ±„νŒ… ai ν”„λ‘œν•„, μ±„νŒ… header UI κ΅¬ν˜„

* Style: font, color 적용 ν˜•μ‹ λ³€κ²½
  • Loading branch information
Nangniya authored Jan 6, 2024
1 parent 086681f commit 2b97abc
Show file tree
Hide file tree
Showing 26 changed files with 418 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/App.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* {
box-sizing: border-box;
}
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Router from './pages';
import { Reset } from 'styled-reset';
import './App.module.scss';

function App() {
return (
Expand Down
1 change: 1 addition & 0 deletions src/apis/aiChatApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
6 changes: 6 additions & 0 deletions src/assets/calendar-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/chichi-chat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/dada-chat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/fonts/Pretendard-Bold.woff
Binary file not shown.
Binary file added src/assets/fonts/Pretendard-Regular.woff
Binary file not shown.
Binary file added src/assets/fonts/Pretendard-SemiBold.woff
Binary file not shown.
6 changes: 6 additions & 0 deletions src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export { ReactComponent as DadaChat } from './dada-chat.svg';
export { ReactComponent as LuluChat } from './lulu-chat.svg';
export { ReactComponent as ChichiChat } from './chichi-chat.svg';
export { ReactComponent as LeftChevron } from './left-shavron.svg';
export { ReactComponent as CalendarIcon } from './calendar-icon.svg';
export { ReactComponent as Plus } from './plus.svg';
3 changes: 3 additions & 0 deletions src/assets/left-shavron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions src/assets/lulu-chat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 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.
22 changes: 22 additions & 0 deletions src/components/Headers/ChatHeader.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@import '../../styles/variables/colors.scss';
@import '../../styles/variables/fonts.scss';

.container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
width: 100%;
height: 56px;
position: fixed;
top: 0;
background-color: $WH;
.title {
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
@include sub18;
}
}
24 changes: 24 additions & 0 deletions src/components/Headers/ChatHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import styles from './ChatHeader.module.scss';
import { LeftChevron, CalendarIcon } from '../../assets';

interface IProps {
children: React.ReactNode;
}

const ChatHeader = ({ children }: IProps) => {
const navigate = useNavigate();
const onGoBack = () => {
navigate(-1);
};
return (
<div className={styles.container}>
<LeftChevron onClick={onGoBack} />
<h3 className={styles.title}>{children}</h3>
<CalendarIcon />
</div>
);
};

export default ChatHeader;
14 changes: 14 additions & 0 deletions src/components/common/AiChatBox.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import '../../styles/variables/fonts.scss';

.container {
display: flex;
gap: 10px;
.messagesWrapper {
display: flex;
flex-direction: column;
gap: 10px;
.aiName {
@include body14;
}
}
}
33 changes: 33 additions & 0 deletions src/components/common/AiChatBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { DadaChat, LuluChat, ChichiChat } from '../../assets';
import LeftChatBox from '../../components/common/LeftChatBox';
import styles from './AiChatBox.module.scss';

interface IProps {
ai: string;
}

const AiChatBox = ({ ai }: IProps) => {
return (
<>
<div className={styles.container}>
{ai === 'dada' ? (
<DadaChat />
) : ai === 'lulu' ? (
<LuluChat />
) : (
<ChichiChat />
)}
<div className={styles.messagesWrapper}>
<p className={styles.aiName}>
{ai === 'dada' ? 'λ‹€λ‹€' : ai === 'lulu' ? '루루' : '치치'}
</p>
<LeftChatBox>μ΄λ ‡κ²Œ! μ΄λ ‡κ²Œ!</LeftChatBox>
<LeftChatBox>{`I'm μ§„μ •μ΄μ—μš”`}</LeftChatBox>
<LeftChatBox>μž₯좩동 μ™•μ‘±λ°œ 보쌈!</LeftChatBox>
</div>
</div>
</>
);
};

export default AiChatBox;
21 changes: 21 additions & 0 deletions src/components/common/LeftChatBox.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import '../../styles/variables/colors.scss';
@import '../../styles/variables/fonts.scss';

.wrapper {
display: flex;
width: 100%;
.message {
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
border-bottom-left-radius: 20px;
background-color: $BK30;
padding: 12px;
max-width: 180px;
}
.time {
display: flex;
align-items: flex-end;
@include navRegular;
color: $BK70;
}
}
17 changes: 17 additions & 0 deletions src/components/common/LeftChatBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import styles from './LeftChatBox.module.scss';

interface IProps {
children: React.ReactNode;
}

const LeftChatBox = ({ children }: IProps) => {
return (
<div className={styles.wrapper}>
<div className={styles.message}>{children}</div>
<span className={styles.time}>μ˜€μ „ 9:54</span>
</div>
);
};

export default LeftChatBox;
23 changes: 23 additions & 0 deletions src/components/common/RightChatBox.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@import '../../styles/variables/colors.scss';
@import '../../styles/variables/fonts.scss';

.wrapper {
display: flex;
width: 100%;
justify-content: flex-end;
.message {
border-top-left-radius: 20px;
border-bottom-right-radius: 20px;
border-bottom-left-radius: 20px;
background-color: $primary_default;
padding: 12px;
max-width: 180px;
color: $WH;
}
.time {
display: flex;
align-items: flex-end;
@include navRegular;
color: $BK70;
}
}
17 changes: 17 additions & 0 deletions src/components/common/RightChatBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import styles from './RightChatBox.module.scss';

interface IProps {
children: React.ReactNode;
}

const RightChatBox = ({ children }: IProps) => {
return (
<div className={styles.wrapper}>
<span className={styles.time}>μ˜€μ „ 9:54</span>
<div className={styles.message}>{children}</div>
</div>
);
};

export default RightChatBox;
5 changes: 5 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ declare module '*.scss' {
const content: { [className: string]: string };
export = content;
}
declare module '*.svg' {
export const ReactComponent: REact.FC<React.SVGProps<SVGSVGElement>>;
const src: string;
export default src;
}
45 changes: 43 additions & 2 deletions src/pages/Chat/Chat.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,45 @@
@import '../../styles/variables/colors.scss';
.example {
background-color: $orange;
@import '../../styles/variables/fonts.scss';

.messagesContainer {
display: flex;
flex-direction: column;
width: 100%;
gap: 20px;
padding: 10px;
margin-top: 56px;
margin-bottom: 48px;
}
.aiChanged {
display: flex;
justify-content: center;
@include caption;
color: $BK70;
}

.inputBox {
display: flex;
justify-content: space-between;
position: fixed;
bottom: 0;
width: 100%;
height: 48px;
.plusBtn {
display: flex;
justify-content: center;
align-items: center;
border: none;
background-color: transparent;
}
.input {
flex-grow: 1;
border: none;
outline: none;
}
.submitBtn {
width: 56px;
border: none;
background-color: $primary_default;
color: $WH;
}
}
25 changes: 24 additions & 1 deletion src/pages/Chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
import styles from './Chat.module.scss';
import { Plus } from '../../assets';
import RightChatBox from '../../components/common/RightChatBox';
import ChatHeader from '../../components/Headers/ChatHeader';
import AiChatBox from '../../components/common/AiChatBox';

const Chat = () => {
return <div className={styles.example}>Chat</div>;
return (
<div>
<ChatHeader>λ‹€λ‹€</ChatHeader>
<div className={styles.messagesContainer}>
<AiChatBox ai="dada" />
<RightChatBox>곡슡경보! 곡슡경보!</RightChatBox>
<p
className={styles.aiChanged}
>{`λŒ€ν™” μƒλŒ€κ°€ '루루'둜 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.`}</p>
<AiChatBox ai="lulu" />
</div>
<div className={styles.inputBox}>
<button className={styles.plusBtn}>
<Plus />
</button>
<input className={styles.input} />
<button className={styles.submitBtn}>전솑</button>
</div>
</div>
);
};

export default Chat;
Loading

0 comments on commit 2b97abc

Please sign in to comment.