Skip to content

Commit

Permalink
[#48] feat: 카운트를 보여주는 ui 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomkoding committed Feb 3, 2022
1 parent 036cd55 commit 3f2929d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 24 deletions.
64 changes: 40 additions & 24 deletions client/src/components/SearchSection/LectureCard.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React from 'react';
import { Switch, Case, Default } from 'react-if';
import { Box, IconButton, Tooltip, Typography, makeStyles, Button } from '@material-ui/core';

import BookmarkIcon from '@material-ui/icons/Bookmark';
import AddIcon from '@material-ui/icons/Add';
import classNames from 'classnames';
import DeleteIcon from '@material-ui/icons/Delete';
import BookmarkBorderIcon from '@material-ui/icons/BookmarkBorder';
import EcoOutlinedIcon from '@material-ui/icons/EcoOutlined';
import EcoIcon from '@material-ui/icons/Eco';
import { SEARCH_TABS } from '../../commons/constants';

const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -69,15 +64,31 @@ const useStyles = makeStyles((theme) => ({
},

buttonItem: {
display: 'flex',
alignItems: 'center',
border: '1px solid #efefef',
borderRadius: 15,
padding: '2px 12px 0 14px',
minWidth: 0,
height: 30,
fontSize: '1rem',
},

buttonIcon: {
marginRight: 5,
fontSize: 20,
lineHeight: '100%',
},

buttonEndIcon: {
marginRight: '0',
selectedButton: {
background: '#e1eef3',
color: '#269ed2',
fontWeight: 800,
border: '2px solid #269ed2',
},

countText: {
lineHeight: '100%',
verticalAlign: 'center',
},
}));

Expand Down Expand Up @@ -110,38 +121,43 @@ export default function LectureCard({
<Box className={classes.buttonGroup}>
<Tooltip title="현재 시간표에 추가" arrow>
<Button
className={classes.buttonItem}
classes={{ startIcon: classes.buttonEndIcon }}
className={classNames({
[classes.buttonItem]: true,
[classes.selectedButton]: false,
})}
classes={{ startIcon: classes.buttonIcon }}
onClick={onAddClick}
startIcon={<AddIcon />}
startIcon="🗓"
>
<Box className={classes.countText}>
<Typography>{lecture.count?.add || ''}</Typography>
</Box>
<Box className={classes.countText}>{lecture.count?.add}</Box>
</Button>
</Tooltip>
<Tooltip title={lecture.isBookmarked ? '즐겨찾기 삭제' : '즐겨찾기 추가'} arrow>
<Button
className={classes.buttonItem}
classes={{ startIcon: classes.buttonEndIcon }}
className={classNames({
[classes.buttonItem]: true,
[classes.selectedButton]: lecture.isBookmarked,
})}
classes={{ startIcon: classes.buttonIcon }}
onClick={lecture.isBookmarked ? onUnbookmarkClick : onBookmarkClick}
startIcon={lecture.isBookmarked ? <BookmarkIcon /> : <BookmarkBorderIcon />}
startIcon="⭐️"
>
<Box className={classes.countText}>
<Typography>{lecture.count?.bookmark || ''}</Typography>
<Typography variant="body2">{lecture.count?.bookmark}</Typography>
</Box>
</Button>
</Tooltip>
<Tooltip title={lecture.isSpike ? '이삭 줍기에서 삭제' : '이삭 줍기에서 추가'} arrow>
<Button
className={classes.buttonItem}
classes={{ startIcon: classes.buttonEndIcon }}
className={classNames({
[classes.buttonItem]: true,
[classes.selectedButton]: lecture.isSpike,
})}
onClick={lecture.isSpike ? onDeleteSpikeClick : onAddSpikeClick}
startIcon={lecture.isSpike ? <EcoIcon /> : <EcoOutlinedIcon />}
startIcon="🍃"
>
<Box className={classes.countText}>
<Typography>{lecture.count?.spike || ''}</Typography>
</Box>
<Box className={classes.countText}>{lecture.count?.spike}</Box>
</Button>
</Tooltip>
</Box>
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"classnames": "^2.3.1"
}
}

0 comments on commit 3f2929d

Please sign in to comment.