-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor Calendar and time utils, create hooks dir, add tsdoc
- update deps - add tsdoc to eslint - refactor calendar to better use luxon library - rename and refactor time utils to make it more clear - create hooks dir and move useInterval.ts there
- Loading branch information
1 parent
82655dc
commit 8ae51a3
Showing
18 changed files
with
304 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Info } from "luxon"; | ||
|
||
import { Grid, GridItem, type GridProps } from "@/lib/styled/jsx"; | ||
import { reorderWeekdaysByStart } from "@/utils/time"; | ||
|
||
export const CalendarHeader = (props: GridProps) => { | ||
return ( | ||
<Grid columns={7} gap="1px" {...props}> | ||
{reorderWeekdaysByStart(Info.weekdays("short")).map((day) => ( | ||
<GridItem key={day} textAlign="center"> | ||
{day} | ||
</GridItem> | ||
))} | ||
</Grid> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { DateTimeMaybeValid } from "luxon"; | ||
|
||
import { Text } from "@/components/ui"; | ||
import { Grid, GridProps } from "@/lib/styled/jsx"; | ||
import { TIME_NARROW } from "@/utils/time"; | ||
|
||
type CalendarTimesProps = { | ||
timeRange: DateTimeMaybeValid[]; | ||
} & GridProps; | ||
|
||
export const CalendarTimes = ({ timeRange, ...rest }: CalendarTimesProps) => { | ||
return ( | ||
<Grid gap="1px" {...rest}> | ||
{timeRange.map((time) => ( | ||
<Grid | ||
key={`${time}`} | ||
pos="relative" | ||
placeContent="end" | ||
// padding-right to account for pseudo-element | ||
pr={4} | ||
_before={{ | ||
content: "''", | ||
pos: "absolute", | ||
w: "3", | ||
// inset bottom -1px to account for border, right 0 to right-align | ||
inset: "auto 0 -1px auto", | ||
borderBottom: "muted", | ||
}} | ||
> | ||
<Text translate="auto" y="50%" fontWeight="normal" fontSize="sm"> | ||
{time.toFormat(TIME_NARROW)} | ||
</Text> | ||
</Grid> | ||
))} | ||
</Grid> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from "./Calendar"; | ||
export * from "./CalendarEvent"; | ||
export * from "./CurrentTime"; | ||
export * from "./CalendarHeader"; | ||
export * from "./CalendarTimes"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
8ae51a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
inkhorn – ./
www.inkhorn.io
inkhorn-git-main-jeremyng.vercel.app
inkhorny.vercel.app
inkhorn.io
inkhorn-jeremyng.vercel.app