-
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.
Merge branch 'main' of github.com:codedazur/toolkit into fix/parallax…
…-performance
- Loading branch information
Showing
59 changed files
with
1,053 additions
and
416 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
67 changes: 67 additions & 0 deletions
67
apps/storybook/stories/react-date-picker/components/Day.tsx
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,67 @@ | ||
import { transparent } from "@codedazur/react-components"; | ||
import styled, { css } from "styled-components"; | ||
|
||
interface DayProps { | ||
isInActiveMonth: boolean; | ||
isInSelectedRange: boolean; | ||
isInFocusedRange: boolean; | ||
isSelected: boolean; | ||
isFirstDate: boolean; | ||
isLastDate: boolean; | ||
} | ||
|
||
export const Day = styled.div.attrs<DayProps>((props) => ({ | ||
background: props.isSelected ? "primary" : transparent, | ||
foreground: "foreground", | ||
...props, | ||
}))<DayProps>` | ||
position: relative; | ||
width: 100%; | ||
padding: 0.25rem; | ||
transition: 0.2s; | ||
border: none; | ||
border-radius: 50%; | ||
${({ theme, isFirstDate, isLastDate, isInFocusedRange, isInSelectedRange }) => | ||
(isFirstDate || isLastDate || isInFocusedRange || isInSelectedRange) && | ||
css` | ||
:before { | ||
content: ""; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: ${theme.colors.primary.alpha(0.25).toString()}; | ||
${isFirstDate && | ||
css` | ||
border-top-left-radius: 50%; | ||
border-bottom-left-radius: 50%; | ||
`} | ||
${isLastDate && | ||
css` | ||
border-top-right-radius: 50%; | ||
border-bottom-right-radius: 50%; | ||
`} | ||
} | ||
`} | ||
${({ isInSelectedRange }) => | ||
!isInSelectedRange && | ||
css` | ||
:hover { | ||
:before { | ||
border-top-right-radius: 50%; | ||
border-bottom-right-radius: 50%; | ||
} | ||
} | ||
`} | ||
${({ isInActiveMonth }) => | ||
!isInActiveMonth && | ||
css` | ||
opacity: 0.25; | ||
`} | ||
`; |
38 changes: 38 additions & 0 deletions
38
apps/storybook/stories/react-date-picker/components/Days.tsx
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,38 @@ | ||
import { | ||
Grid, | ||
GridItem, | ||
UseDatePickerResult, | ||
} from "@codedazur/react-components"; | ||
import { FunctionComponent } from "react"; | ||
import { Day } from "./Day"; | ||
|
||
interface MonthProps { | ||
days: UseDatePickerResult["month"]["days"]; | ||
onDayClick?: (date: Date) => void; | ||
} | ||
|
||
export const Days: FunctionComponent<MonthProps> = ({ days, onDayClick }) => ( | ||
<Grid columns={7}> | ||
{days.map((day, index) => ( | ||
<GridItem key={index}> | ||
{day !== null && ( | ||
<Day | ||
type="button" | ||
isInFocusedRange={day.isInFocusedRange} | ||
isInSelectedRange={day.isInSelectedRange} | ||
isSelected={day.isSelected} | ||
isFirstDate={day.isFirstDate} | ||
isLastDate={day.isLastDate} | ||
isInActiveMonth={day.isInActiveMonth} | ||
disabled={day.isDisabled} | ||
onClick={onDayClick ? () => onDayClick(day.date) : day.onClick} | ||
onMouseEnter={day.onMouseEnter} | ||
onMouseLeave={day.onMouseLeave} | ||
> | ||
{day.label} | ||
</Day> | ||
)} | ||
</GridItem> | ||
))} | ||
</Grid> | ||
); |
33 changes: 33 additions & 0 deletions
33
apps/storybook/stories/react-date-picker/components/Navigation.tsx
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,33 @@ | ||
import { | ||
ChevronLeftIcon, | ||
ChevronRightIcon, | ||
IconButton, | ||
Padding, | ||
Row, | ||
} from "@codedazur/react-components"; | ||
import { FunctionComponent, MouseEventHandler } from "react"; | ||
import { Monospace } from "../../../components/Monospace"; | ||
|
||
interface NavigationProps { | ||
label?: string; | ||
onNextClick?: MouseEventHandler; | ||
onPreviousClick?: MouseEventHandler; | ||
} | ||
|
||
export const Navigation: FunctionComponent<NavigationProps> = ({ | ||
label = "", | ||
onNextClick, | ||
onPreviousClick, | ||
}) => ( | ||
<Padding all="0.5rem"> | ||
<Row justify="space-between" align="center"> | ||
<IconButton onClick={onPreviousClick}> | ||
<ChevronLeftIcon /> | ||
</IconButton> | ||
<Monospace>{label}</Monospace> | ||
<IconButton onClick={onNextClick}> | ||
<ChevronRightIcon /> | ||
</IconButton> | ||
</Row> | ||
</Padding> | ||
); |
27 changes: 27 additions & 0 deletions
27
apps/storybook/stories/react-date-picker/components/Weekdays.tsx
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,27 @@ | ||
import { | ||
EdgeInset, | ||
Expanded, | ||
Grid, | ||
GridItem, | ||
UseDatePickerResult, | ||
} from "@codedazur/react-components"; | ||
import { FunctionComponent } from "react"; | ||
import { Monospace } from "../../../components/Monospace"; | ||
|
||
interface WeekdaysProps { | ||
weekdays: UseDatePickerResult["month"]["weekdays"]; | ||
} | ||
|
||
export const Weekdays: FunctionComponent<WeekdaysProps> = ({ weekdays }) => ( | ||
<Grid columns={7}> | ||
{weekdays.map(({ label }, index) => ( | ||
<GridItem key={index}> | ||
<EdgeInset vertical="0.5rem"> | ||
<Expanded> | ||
<Monospace align="center">{label}</Monospace> | ||
</Expanded> | ||
</EdgeInset> | ||
</GridItem> | ||
))} | ||
</Grid> | ||
); |
Oops, something went wrong.