Skip to content

Commit

Permalink
Merge pull request #73 from prgrms-web-devcourse-final-project/41-des…
Browse files Browse the repository at this point in the history
…ign/chat

[Design] #41  ChatModal
  • Loading branch information
shlee9999 authored Nov 22, 2024
2 parents 27f4e1f + 4b695e2 commit c865202
Show file tree
Hide file tree
Showing 19 changed files with 462 additions and 34 deletions.
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function App() {
//* 다크모드 확장성 고려
const [theme, setTheme] = useState(lightTheme)
const toggleTheme = () => setTheme(prev => (prev === lightTheme ? darkTheme : lightTheme))

return (
<>
<HelmetProvider>
Expand All @@ -27,9 +26,9 @@ function App() {
<GlobalStyle />
<MobileWrapper>
<RouterProvider router={router} />
<ModalContainer />
</MobileWrapper>
<PWABadge />
<ModalContainer />
</ThemeProvider>
</HelmetProvider>
</>
Expand Down
3 changes: 0 additions & 3 deletions src/components/Button/CloseButton/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { styled } from 'styled-components'
import { MdClose } from 'react-icons/md'

export const CloseButton = styled(MdClose)`
position: absolute;
width: 28px;
height: 28px;
top: 12px;
right: 20px;
`
4 changes: 0 additions & 4 deletions src/components/Button/PrevButton/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { styled } from 'styled-components'
import { GrPrevious } from 'react-icons/gr'

export const PrevButton = styled(GrPrevious)`
position: absolute;
left: 20px;
top: 14px;
width: 28px;
height: 28px;
z-index: 5;
`
22 changes: 22 additions & 0 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ReactNode } from 'react'
import * as S from './styles'
import { HeaderType } from '~types/headerType'

type HeaderProps = {
prevBtn?: boolean
closeBtn?: boolean
onClickPrev?: () => void
onClickClose?: () => void
children: ReactNode
type: HeaderType
}

export default function Header({ onClickPrev, onClickClose, children, type, prevBtn, closeBtn }: HeaderProps) {
return (
<S.Header $type={type}>
{prevBtn ? <S.HeaderPrevBtn onClick={onClickPrev} /> : null}
{closeBtn ? <S.HeaderCloseBtn onClick={onClickClose} /> : null}
{children}
</S.Header>
)
}
31 changes: 31 additions & 0 deletions src/components/Header/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import styled from 'styled-components'
import CloseButton from '~components/Button/CloseButton'
import PrevButton from '~components/Button/PrevButton'
import { HEADER_HEIGHT, HEADER_HEIGHT_LG, HEADER_Z_INDEX } from '~constants/layout'
import { HeaderType } from '~types/headerType'

type HeaderProps = {
$type: HeaderType
}

export const Header = styled.header<HeaderProps>`
height: ${({ $type }) => ($type === 'sm' ? HEADER_HEIGHT : HEADER_HEIGHT_LG)}px;
position: fixed;
padding-left: 20px;
padding-right: 20px;
background-color: ${({ theme }) => theme.colors.grayscale.gc_4};
top: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
z-index: ${HEADER_Z_INDEX};
`

export const HeaderPrevBtn = styled(PrevButton)`
margin-right: 8px;
`
export const HeaderCloseBtn = styled(CloseButton)`
position: absolute;
right: 20px;
`
17 changes: 17 additions & 0 deletions src/components/Message.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { styled } from 'styled-components'

const Message = styled.div`
padding: 9.5px 16px;
border-radius: 12px;
white-space: pre-line;
margin: 16px 0;
`
export const OutgoingMessage = styled(Message)`
margin-left: auto;
width: fit-content;
background-color: ${({ theme }) => theme.colors.brand.lighten_2};
`
export const IncomingMessage = styled(Message)`
width: fit-content;
background-color: ${({ theme }) => theme.colors.grayscale.gc_4};
`
12 changes: 12 additions & 0 deletions src/components/Profile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import styled from 'styled-components'

type ProfileProps = {
$size: number
$src: string
}
export const Profile = styled.div<ProfileProps>`
width: ${({ $size }) => $size + 'px'};
height: ${({ $size }) => $size + 'px'};
background: url(${({ $src }) => $src}) center/cover ${({ theme }) => theme.colors.brand.sub};
border-radius: 50%;
`
15 changes: 15 additions & 0 deletions src/components/SendMessageForm/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Typo14 } from '~components/Typo'
import * as S from './styles'

type SendMessageFormProps = React.FormHTMLAttributes<HTMLFormElement>

export default function SendMessageForm({ ...rest }: SendMessageFormProps) {
return (
<S.SendMessageForm {...rest}>
<S.ChatInput placeholder='채팅 내용 입력' />
<S.SendBtn>
<Typo14 weight='700'>전송</Typo14>
</S.SendBtn>
</S.SendMessageForm>
)
}
24 changes: 24 additions & 0 deletions src/components/SendMessageForm/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { styled } from 'styled-components'

export const SendMessageForm = styled.form`
padding: 20.5px 20px;
position: fixed;
bottom: 0;
left: 0;
height: 64px;
width: 100%;
background-color: ${({ theme }) => theme.colors.grayscale.gc_4};
display: flex;
align-items: center;
gap: 12px;
`
export const ChatInput = styled.input`
flex: 1;
border: none;
font-weight: 500;
`
export const SendBtn = styled.button`
background-color: ${({ theme }) => theme.colors.brand.lighten_2};
padding: 9.5px 16px;
border-radius: 32px;
`
8 changes: 6 additions & 2 deletions src/components/Separator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { styled } from 'styled-components'

export const Separator = styled.hr`
type SeparatorProps = {
$height: number
}

export const Separator = styled.hr<SeparatorProps>`
border: none;
width: 1px;
height: 20px;
height: ${({ $height }) => $height + 'px'};
background-color: ${({ theme }) => theme.colors.grayscale.gc_1};
`
5 changes: 4 additions & 1 deletion src/constants/layout.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const FOOTER_HEIGHT = 56
export const HEADER_HEIGHT = 56
export const HEADER_HEIGHT_LG = 80
export const HEADER_Z_INDEX = 80

export const FOOTER_HEIGHT = 56
Loading

0 comments on commit c865202

Please sign in to comment.