Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/sparcs-kaist/biseo into test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsdn0 committed Mar 27, 2024
2 parents 9e1280e + f52da03 commit 6eac878
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 35 deletions.
12 changes: 9 additions & 3 deletions packages/web/src/components/atoms/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { css } from "@emotion/react";
import styled from "@emotion/styled";
import type { Color } from "@biseo/web/theme";

export const Divider = styled.hr<{
dir?: "horizontal" | "vertical";
color?: Color;
}>(
({ dir = "horizontal", theme }) => css`
({ dir = "horizontal", color = "gray300", theme }) => css`
border: none;
${dir === "horizontal"
? css`
width: 100%;
border-bottom: 1px solid ${theme.colors.gray300};
height: 1px;
border: none;
background-color: ${theme.colors[color]};
`
: css`
width: 1px;
height: 100%;
border-right: 1px solid ${theme.colors.gray300};
border: none;
background-color: ${theme.colors[color]};
`}
`,
);
4 changes: 3 additions & 1 deletion packages/web/src/components/atoms/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Cell = styled.td<{ w?: Size; scroll?: boolean }>(
padding: 6px 5px;
font-size: 10px;
font-weight: 500;
line-break: anywhere;
`,
);

Expand Down Expand Up @@ -45,7 +46,8 @@ export const Body = styled.tbody`
export const Row = styled.tr<{ selected?: boolean }>`
position: relative;
display: flex;
height: 32px;
min-height: 32px;
height: fit-content;
align-items: center;
gap: 5px;
background-color: ${props =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const AdminOngoingAgendaCard: React.FC<Props> = ({ agenda }) => {
};

return (
<Card onClick={openModal}>
<Card clickable onClick={openModal}>
<div css={[column, gap(8), w("fill")]}>
<AgendaTag
tags={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const AdminPreparingAgendaCard: React.FC<Props> = ({ agenda }) => {
};

return (
<Card onClick={openModal}>
<Card clickable onClick={openModal}>
<div css={[column, gap(8), w("fill")]}>
<AgendaTag
tags={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const AgendaTemplateCard: React.FC<Props> = ({ template }) => {
const openModal = () => navigate(`templateEdit?templateId=${template.id}`);

return (
<Card onClick={openModal}>
<Card clickable onClick={openModal}>
<Box gap={8} w="fill">
<AdminTag tags={adminTags} suffix={template.choices.length} />
<Box gap={11}>
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/molecules/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const formStyle = css`
${bg.white}
${border.gray300}
${round.md}
${align.center}
`;

const textAreaScrollStyle = css`
Expand Down
55 changes: 31 additions & 24 deletions packages/web/src/components/molecules/ModalInnerTextBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ import {
Button,
Clickable,
TaggersBox,
Divider,
} from "@biseo/web/components/atoms";
import "@biseo/web/components/atoms/placeholder.css";
import { TrashIcon } from "@biseo/web/assets";
import { css } from "@emotion/react";
import { scroll, scrollBar } from "@biseo/web/styles";
import {
w,
h,
padding,
scroll,
scrollBar,
bg,
align,
column,
gap,
border,
round,
} from "@biseo/web/styles";

interface ModalInnerProps extends PropsWithChildren {
title: string;
Expand Down Expand Up @@ -185,11 +198,8 @@ const TextButton: React.FC<SubmitProps> = ({
}) => (
<BorderedBox
w={300}
borderColor="gray200"
bg="gray100"
borderSize={1}
roundBot={5}
roundTop={0}
borderStyle="solid"
dir="row"
align="center"
Expand Down Expand Up @@ -269,30 +279,27 @@ const AddVoteOptionArea: React.FC<SubmitProps> = ({
onClick,
onSubmit,
}) => (
<Box w={300}>
<BorderedBox
borderColor="gray200"
bg="white"
w="fill"
h={152}
borderSize={1}
pad={10}
padRight={0}
roundBot={0}
roundTop={5}
borderStyle="solid"
align="stretch"
<div css={[w(300), border.gray200, round.md, `overflow: hidden`]}>
<div
css={[
bg.white,
w("fill"),
h(152),
padding(10),
column,
align.stretch,
scroll.y,
scrollBar,
gap(10),
]}
>
<Scroll>
<Box w="fill" gap={10}>
{children}
</Box>
</Scroll>
</BorderedBox>
{children}
</div>
<Divider color="gray200" />
<TextButton onClick={onClick} onSubmit={onSubmit} value={value}>
새로운 항목
</TextButton>
</Box>
</div>
);
ModalInner.AddVoteOptionArea = AddVoteOptionArea;

Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/molecules/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const Profile: React.FC<Props> = ({ displayName, onLogout }) => (
w(100),
h(18),
padding.horizontal(8),
padding.vertical(2),
justify.between,
align.center,
]}
Expand Down
23 changes: 19 additions & 4 deletions packages/web/src/components/organisms/ChatSection.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useEffect } from "react";
import styled from "@emotion/styled";
import { useInView } from "react-intersection-observer";

import { Text } from "@biseo/web/components/atoms";
import { formatDate } from "@biseo/web/utils/format";
import { Divider, Text } from "@biseo/web/components/atoms";
import {
ChatHeader,
ChatInput,
Message,
} from "@biseo/web/components/molecules";
import { margin, round, padding, center, text } from "@biseo/web/styles";
import { useChat } from "@biseo/web/services";

const Container = styled.div`
Expand Down Expand Up @@ -36,8 +37,22 @@ export const ChatSection: React.FC = () => {
<Container>
<ChatHeader title="스레드" />
<Message.List ref={scrollRef}>
{messages.map(message => (
<Message key={message.id} message={message} />
{messages.map((message, index) => (
<>
<Message key={message.id} message={message} />
{formatDate(messages[index + 1]?.createdAt) !==
formatDate(message.createdAt) && (
<div
css={[round.xl, padding(8), center, text.body, text.gray500]}
>
<Divider />
<span css={[margin(8), `white-space: nowrap`]}>
{formatDate(message.createdAt)}
</span>
<Divider />
</div>
)}
</>
))}
{hasMore && (
<Text ref={ref} variant="body" color="gray400">
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ export const formatTime = (isoString: string) => {

return `${ampm} ${displayHours}:${displayMinutes}`;
};

export const formatDate = (isoString: string) => {
const time = new Date(isoString);

const year = time.getFullYear();
const month = time.getMonth() + 1;
const date = time.getDate();
const day = ["일", "월", "화", "수", "목", "금", "토"][time.getDay()];

return `${year}${month}${date}일 (${day})`;
};

0 comments on commit 6eac878

Please sign in to comment.