-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PBNTR-637] Adding defaultDate prop to Date Picker Quick Pick variant (…
…#3907) **What does this PR do?** Adding defaultDate prop to Date Picker Quick Pick variant ![image](https://github.com/user-attachments/assets/b0b7607f-fa01-404f-a8e1-8adf9f35f447) #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review. - [ ] **TESTS** I have added test coverage to my code.
- Loading branch information
1 parent
39fed4a
commit c97590f
Showing
7 changed files
with
108 additions
and
2 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
42 changes: 42 additions & 0 deletions
42
...ok/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.html.erb
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,42 @@ | ||
<%= pb_rails("date_picker", props: { | ||
allow_input: true, | ||
default_date: "This month", | ||
end_date_id: "quick-pick-end-date", | ||
end_date_name: "quick-pick-end-date", | ||
mode: "range", | ||
picker_id: "quick-pick-default-date", | ||
placeholder: "mm/dd/yyyy to mm/dd/yyyy", | ||
selection_type: "quickpick", | ||
start_date_id: "quick-pick-start-date", | ||
start_date_name: "quick-pick-start-date" | ||
}) %> | ||
|
||
<%= pb_rails("date_picker", props: { | ||
allow_input: true, | ||
custom_quick_pick_dates: { | ||
dates: [ | ||
{ | ||
label: "Last 15 months", | ||
value: { | ||
timePeriod: "months", | ||
amount: 15, | ||
}, | ||
}, | ||
{ | ||
label: "First Week of June 2022", | ||
value: ["06/01/2022", "06/07/2022"], | ||
}, | ||
], | ||
}, | ||
default_date: "First Week of June 2022", | ||
end_date_id: "quick-pick-end-date", | ||
end_date_name: "quick-pick-end-date", | ||
label: "Custom Date Picker", | ||
mode: "range", | ||
picker_id: "custom-quick-pick-default-date", | ||
placeholder: "mm/dd/yyyy to mm/dd/yyyy", | ||
selection_type: "quickpick", | ||
start_date_id: "quick-pick-start-date", | ||
start_date_name: "quick-pick-start-date" | ||
}) %> | ||
|
44 changes: 44 additions & 0 deletions
44
playbook/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.jsx
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,44 @@ | ||
import React from "react" | ||
import DatePicker from "../_date_picker" | ||
|
||
const DatePickerQuickPickDefaultDate = (props) => ( | ||
<> | ||
<DatePicker | ||
allowInput | ||
defaultDate="This month" | ||
mode="range" | ||
pickerId="quick-pick-default-date" | ||
placeholder="mm/dd/yyyy to mm/dd/yyyy" | ||
selectionType="quickpick" | ||
{...props} | ||
/> | ||
|
||
<DatePicker | ||
allowInput | ||
customQuickPickDates={{ | ||
dates: [ | ||
{ | ||
label: "Last 15 months", | ||
value: { | ||
timePeriod: "months", | ||
amount: 15, | ||
}, | ||
}, | ||
{ | ||
label: "First Week of June 2022", | ||
value: ["06/01/2022", "06/07/2022"], | ||
}, | ||
], | ||
}} | ||
defaultDate="First Week of June 2022" | ||
label="Custom Date Picker" | ||
mode="range" | ||
pickerId="custom-quick-pick-default-date" | ||
placeholder="mm/dd/yyyy to mm/dd/yyyy" | ||
selectionType="quickpick" | ||
{...props} | ||
/> | ||
</> | ||
) | ||
|
||
export default DatePickerQuickPickDefaultDate |
1 change: 1 addition & 0 deletions
1
...pp/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.md
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 @@ | ||
To set a default value using Quick Pick, use the `defaultDate` or `default_date` prop. This prop should match one of the labels displayed in the UI of the dropdown menu. |
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