Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat isOutsideRange prop #1375

Merged
merged 1 commit into from
Aug 21, 2023
Merged

Feat isOutsideRange prop #1375

merged 1 commit into from
Aug 21, 2023

Conversation

takurinton
Copy link
Contributor

@takurinton takurinton commented Aug 18, 2023

#975

isOutsideRange prop の追加。
react-dates の isOutsideRange prop と同じ挙動をする。

以下のコンポーネントに追加。

  • Calendar
  • CalendarRange
  • DatePicker
  • DateRangePicker

@changeset-bot
Copy link

changeset-bot bot commented Aug 18, 2023

🦋 Changeset detected

Latest commit: 574b04d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
ingred-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Aug 18, 2023

Deploy Preview for ingred-ui ready!

Name Link
🔨 Latest commit 574b04d
🔍 Latest deploy log https://app.netlify.com/sites/ingred-ui/deploys/64df2169d5470b0008ec8f8a
😎 Deploy Preview https://deploy-preview-1375--ingred-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@takurinton
Copy link
Contributor Author

takurinton commented Aug 18, 2023

こんな感じで指定した範囲が disable になってる(スクロールはできる)
image

export const DayContainer = styled.button<{ selected: boolean }>`
const DayContainerBase = styled.button<{ selected?: boolean }>`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

元々使っていた DayContainer をベースにして、DayContainerDisableDayContainer の共通部分として定義

Comment on lines +93 to +94
const isOutsideRange = (day: dayjs.Dayjs) =>
day.isBefore(dayjs().subtract(1, "day"));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

story では1日前から選択できないようにしている

@takurinton takurinton force-pushed the feat-is-outside-range-calendar branch from 996e914 to 574b04d Compare August 18, 2023 07:44
@takurinton takurinton changed the title Feat isOutsideRange calendar Feat isOutsideRange prop Aug 18, 2023
dayjs(new Date(m.year(), m.month(), day)),
);

return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits
returnでネストしちゃうならインラインで書いちゃえ派だった。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

条件が若干複雑に見えるので分けてしまいました。
まあこういう派閥の領域を縛るなら lint かな。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一旦ここはこのままでmm

@takurinton takurinton merged commit 3d98e32 into master Aug 21, 2023
2 checks passed
@takurinton takurinton deleted the feat-is-outside-range-calendar branch August 21, 2023 08:48
@FluctMember FluctMember mentioned this pull request Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants