Skip to content

Commit

Permalink
Fixed build error and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SeDemal committed Jul 16, 2023
1 parent b6df54c commit fec7d6d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
28 changes: 16 additions & 12 deletions src/widgets/calendar/CalendarDay.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Container, Indicator, IndicatorProps, Popover, Center } from '@mantine/core';
import { Container, Indicator, IndicatorProps, Popover, useMantineTheme, Button } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
import { MediaList } from './MediaList';
import { MediasType } from './type';
Expand All @@ -12,6 +12,7 @@ interface CalendarDayProps {

export const CalendarDay = ({ date, medias, size }: CalendarDayProps) => {
const [opened, { close, open }] = useDisclosure(false);
const { radius, fn } = useMantineTheme();
var indicatorSize = 10;
var indicatorOffset = -4;
switch(size){
Expand Down Expand Up @@ -54,18 +55,21 @@ export const CalendarDay = ({ date, medias, size }: CalendarDayProps) => {
}}
onClose={close}
opened={opened}
sx={(theme : any) => ({
padding:'18% !important',
height: '100%',
width: '100%',
borderRadius: (size!=="xs" && size!=="sm")?theme.radius.lg:theme.radius.md,
borderStyle: "solid",
borderWidth: "0.2rem",
borderColor: opened? theme.fn.primaryColor() : '#00000000',
})}
>
<Popover.Target>
<Container align="center" onClick={(medias.totalCount === 0)? undefined:open}>
<Container
onClick={medias.totalCount > 0 ? open : undefined}
sx={{ root: {
padding:'18% !important',
height: '100%',
width: '100%',
alignContent: 'center',
borderRadius: ['xs','sm'].includes(size) ? radius.md : radius.lg,
borderStyle: "solid",
borderWidth: "0.2rem",
borderColor: opened ? fn.primaryColor() : 'transparent',
}}}
>
<DayIndicator size={indicatorSize} offset={indicatorOffset} color="red" position="bottom-start" medias={medias.books}>
<DayIndicator size={indicatorSize} offset={indicatorOffset} color="yellow" position="top-start" medias={medias.movies}>
<DayIndicator size={indicatorSize} offset={indicatorOffset} color="blue" position="top-end" medias={medias.tvShows}>
Expand All @@ -77,7 +81,7 @@ export const CalendarDay = ({ date, medias, size }: CalendarDayProps) => {
</DayIndicator>
</Container>
</Popover.Target>
<Popover.Dropdown disabled = {(medias.totalCount === 0)? false:true}>
<Popover.Dropdown>
<MediaList medias={medias} />
</Popover.Dropdown>
</Popover>
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/calendar/CalendarTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function CalendarTile({ widget }: CalendarTileProps) {
size={widget.properties.fontSize}
locale={i18n?.resolvedLanguage ?? 'en'}
firstDayOfWeek={widget.properties.sundayStart ? 0 : 1}
hideWeekdays={widget.properties.hideWeekDays ? true : false}
hideWeekdays={widget.properties.hideWeekDays}
style={{ position: 'relative' }}
date={month}
maxLevel="month"
Expand Down Expand Up @@ -129,7 +129,7 @@ function CalendarTile({ widget }: CalendarTileProps) {
flex: 1,
},
day:{
borderRadius: (widget.properties.fontSize !== "xs" && widget.properties.fontSize!=="sm")? radius.lg:radius.md,
borderRadius: ['xs','sm'].includes(widget.properties.fontSize) ? radius.md : radius.lg,
},
}}
getDayProps={(date) => ({
Expand Down

0 comments on commit fec7d6d

Please sign in to comment.