Skip to content

Commit

Permalink
[#48] feat: front design add numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Jan 26, 2022
1 parent b6234b4 commit a3c7536
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 29 deletions.
80 changes: 52 additions & 28 deletions client/src/components/SearchSection/LectureCard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Switch, Case, Default } from 'react-if';
import { Box, IconButton, Tooltip, Typography, makeStyles } from '@material-ui/core';
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';
Expand Down Expand Up @@ -67,6 +67,18 @@ const useStyles = makeStyles((theme) => ({
marginLeft: 'auto',
paddingRight: '10px',
},

buttonItem: {
lineHeight: '100%',
},

buttonEndIcon: {
marginRight: '0',
},

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

export default function LectureCard({
Expand Down Expand Up @@ -96,33 +108,45 @@ export default function LectureCard({
const DefaultButtonGroup = () => {
return (
<Box className={classes.buttonGroup}>
<IconButton onClick={onAddClick}>
<Tooltip title="현재 시간표에 추가" arrow>
<AddIcon />
</Tooltip>
</IconButton>
<IconButton onClick={lecture.isBookmarked ? onUnbookmarkClick : onBookmarkClick}>
{lecture.isBookmarked ? (
<Tooltip title="즐겨찾기 삭제" arrow>
<BookmarkIcon />
</Tooltip>
) : (
<Tooltip title="즐겨찾기 추가" arrow>
<BookmarkBorderIcon />
</Tooltip>
)}
</IconButton>
<IconButton onClick={lecture.isSpike ? onDeleteSpikeClick : onAddSpikeClick}>
{lecture.isSpike ? (
<Tooltip title="이삭 줍기에서 삭제" arrow>
<EcoIcon />
</Tooltip>
) : (
<Tooltip title="이삭 줍기에서 추가" arrow>
<EcoOutlinedIcon />
</Tooltip>
)}
</IconButton>
<Tooltip title="현재 시간표에 추가" arrow>
<Button
className={classes.buttonItem}
classes={{ startIcon: classes.buttonEndIcon }}
onClick={onAddClick}
startIcon={<AddIcon />}
>
{/* <Typography className={classes.countText}>10</Typography> */}
<Box className={classes.countText}>
<Typography>10</Typography>
</Box>
</Button>
</Tooltip>
<Tooltip title={lecture.isBookmarked ? '즐겨찾기 삭제' : '즐겨찾기 추가'} arrow>
<Button
className={classes.buttonItem}
classes={{ startIcon: classes.buttonEndIcon }}
onClick={lecture.isBookmarked ? onUnbookmarkClick : onBookmarkClick}
startIcon={lecture.isBookmarked ? <BookmarkIcon /> : <BookmarkBorderIcon />}
>
{/* <Typography className={classes.countText}>10</Typography> */}
<Box className={classes.countText}>
<Typography>10</Typography>
</Box>
</Button>
</Tooltip>
<Tooltip title={lecture.isSpike ? '이삭 줍기에서 삭제' : '이삭 줍기에서 추가'} arrow>
<Button
className={classes.buttonItem}
classes={{ startIcon: classes.buttonEndIcon }}
onClick={lecture.isSpike ? onDeleteSpikeClick : onAddSpikeClick}
startIcon={lecture.isSpike ? <EcoIcon /> : <EcoOutlinedIcon />}
>
{/* <Typography className={classes.countText}>10</Typography> */}
<Box className={classes.countText}>
<Typography>10</Typography>
</Box>
</Button>
</Tooltip>
</Box>
);
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/models/Lecture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Axios } from '../lib/axios';
import { isIn } from '../utils/helper';

export default class Lecture {
constructor(raw, bookmarks = [], spikes = []) {
constructor(raw, bookmarks = [], spikes = [], counts = {}) {
this.id = raw.id;
this.gubun = raw.gubun;
this.code = raw.code;
Expand Down

0 comments on commit a3c7536

Please sign in to comment.