Skip to content

Commit 8ddde7b

Browse files
authored
Feat/#219-S : 블록 선택할 수 있는 UI 구현 (#225)
* feat : 블록 선택 아이템 UI 구현 * feat : 블록 선택 UI 구현 * chore : import 순서 자동 반영 * refactor : 코드리뷰 반영
1 parent aeac4ca commit 8ddde7b

File tree

6 files changed

+122
-1
lines changed

6 files changed

+122
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import style from './style.module.scss';
2+
3+
interface BlockItemProps {
4+
name: string;
5+
desc: string;
6+
thumbnail: string;
7+
}
8+
9+
function BlockItem({ name, desc, thumbnail }: BlockItemProps) {
10+
return (
11+
<li className={style['block-item']}>
12+
<img src={thumbnail} alt={name + '블록'} />
13+
14+
<div className={style.text}>
15+
<div className={style.name}>{name}</div>
16+
<span className={style.desc}>{desc}</span>
17+
</div>
18+
</li>
19+
);
20+
}
21+
22+
export default BlockItem;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@import 'styles/color.module';
2+
3+
.block-item {
4+
display: flex;
5+
margin: 5px;
6+
padding: 5px;
7+
font-size: 12px;
8+
cursor: pointer;
9+
10+
&:hover {
11+
background-color: $gray-300-transparent;
12+
}
13+
14+
img {
15+
width: 46px;
16+
height: 46px;
17+
background-color: $white;
18+
box-shadow: rgb(15 15 15 / 10%) 0px 0px 0px 1px;
19+
}
20+
21+
.text {
22+
flex: 1 1 auto;
23+
margin-left: 6px;
24+
.name {
25+
color: $black;
26+
}
27+
.desc {
28+
color: $gray-100;
29+
}
30+
}
31+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { BLOCKS_TYPE } from 'src/constants/block';
2+
3+
import BlockItem from './BlockItem';
4+
import style from './style.module.scss';
5+
6+
function BlockSelector() {
7+
return (
8+
<div className={style['block-selector']}>
9+
<div className={style['block-displayed']}>
10+
<strong>블록</strong>
11+
12+
<ul className={style['block-list']}>
13+
{BLOCKS_TYPE.map(({ id, name, desc, thumbnail }) => (
14+
<BlockItem key={id} {...{ id, name, desc, thumbnail }} />
15+
))}
16+
</ul>
17+
</div>
18+
</div>
19+
);
20+
}
21+
22+
export default BlockSelector;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@import 'styles/color.module';
2+
3+
.block-selector {
4+
height: 100%;
5+
overflow: hidden;
6+
7+
.block-displayed {
8+
display: flex;
9+
flex-direction: column;
10+
min-width: 300px;
11+
max-height: 280px;
12+
padding: 5px;
13+
overflow: auto;
14+
border-radius: 4px;
15+
background-color: $white;
16+
box-shadow: rgb(15 15 15 / 5%) 0px 0px 0px 1px,
17+
$gray-300-transparent 0px 3px 6px, $gray-300-transparent 0px 9px 24px;
18+
19+
strong {
20+
margin-bottom: 5px;
21+
margin-left: 5px;
22+
color: $gray-100;
23+
font-size: 12px;
24+
}
25+
}
26+
}

client/src/components/Workspace/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Mom from 'components/Mom';
22
import Sidebar from 'components/Sidebar';
3-
import { useState, useEffect, useMemo } from 'react';
3+
import { useEffect, useMemo, useState } from 'react';
44
import { useParams } from 'react-router-dom';
55
import { getWorkspaceInfo } from 'src/apis/workspace';
66
import ConfMediaBar from 'src/components/ConfMediaBar';

client/src/constants/block.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const BLOCKS_TYPE = [
2+
{
3+
id: 1,
4+
name: '텍스트',
5+
desc: '일반 텍스트',
6+
thumbnail: 'https://www.notion.so/images/blocks/text/ko-KR.png',
7+
},
8+
{
9+
id: 2,
10+
name: '투표',
11+
desc: '투표할 때 사용해보세요',
12+
thumbnail: 'https://www.notion.so/images/blocks/embed.6a481331.png',
13+
},
14+
{
15+
id: 3,
16+
name: '질문',
17+
desc: '질문할 때 사용해보세요',
18+
thumbnail: 'https://www.notion.so/images/blocks/to-do.f8d20542.png',
19+
},
20+
];

0 commit comments

Comments
 (0)