diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index dfab7fd..f3f18a1 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -9,6 +9,7 @@ const DropdownContainer = styled.div` max-height: 396px; border-radius: 3px; overflow-y: auto; + opacity: 0.97; box-shadow: 0.05em 0.2em 0.6em rgba(0, 0, 0, 0.2); scroll-snap-type: y mandatory; scroll-behavior: smooth; @@ -19,7 +20,7 @@ const DropdownContainer = styled.div` ::-webkit-scrollbar { background-color: #f2f4f7; width: 5px; - border-style:none; + border-style: none; } ::-webkit-scrollbar-thumb { border-radius: 10px; diff --git a/src/components/SchedulerRow.tsx b/src/components/SchedulerRow.tsx index d0ef2a6..d73d6b1 100644 --- a/src/components/SchedulerRow.tsx +++ b/src/components/SchedulerRow.tsx @@ -65,8 +65,22 @@ const StyledTypography = styled(Typography)` background-color: white; `; -const BoldParagraph = styled.p` +const threeStyles = () => { + return ` + white-space: nowrap; + text-overflow: ellipsis; + max-width: 70px;`; +}; + + +type BoldParagraphProps = { + isThree?: boolean; +}; + +const BoldParagraph = styled.p` + overflow: hidden; flex: 3; + ${({ isThree }) => isThree && threeStyles} `; const ClassWrap = styled.div` @@ -97,27 +111,18 @@ interface SchedulerRowProps { } const getGroupsPerDay = (groups: Array) => { - - const xd = groups.reduce((sum:any,group:SchedulerEvent)=>{ - if (sum.hasOwnProperty(group.day)) - { - return sum[group.day]+=1 - } - else{ - return sum[group.day]=0} - },[]) - - console.log("123123123",xd); - return xd; -} + const groupsPerDay: any = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0 }; + for (const group of groups) { + groupsPerDay[group.day]++; + } + return groupsPerDay; +}; export const SchedulerRow = ({ groups, indexRow, rowTop, cellWidth, cellHeight }: SchedulerRowProps) => { const classes = useStyles(); const [anchorEl, setAnchorEl] = React.useState(null); const [popoverId, setPopoverId] = useState(null); - const groupsPerDay = getGroupsPerDay(groups); - //looks weird const handlePopoverOpen = (event: MouseEvent) => { setAnchorEl(event.currentTarget); @@ -129,7 +134,6 @@ export const SchedulerRow = ({ groups, indexRow, rowTop, cellWidth, cellHeight } setPopoverId(null); }; - const open = Boolean(anchorEl); return ( @@ -159,13 +163,17 @@ export const SchedulerRow = ({ groups, indexRow, rowTop, cellWidth, cellHeight } onMouseLeave={handlePopoverClose} > - {groups[index].name} - -
- {cellWidth > 200 ? `${groups[index].time[0]} - ${groups[index].time[1]}` : ''} -
-
3/30
-
+ = 3}>{groups[index].name} + {groupsPerDay[group.day] < 3 ? ( + +
{`${groups[index].time[0]}-${groups[index].time[1]}`}
+
3/30
+
+ ) : ( + +
3/30
+
+ )}