-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(datetime): add multiple selection playground #2442
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1094b53
docs(datetime): add multiple selection playground
a316993
use note component
ab79f25
docs(datetime): clarify wording
3c547a8
docs(datetime): add preferWheel note and move multiple selection higher
02c5f86
docs(datetime): revert multiple playground to use latest Ionic version
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,7 @@ | ||
```html | ||
<ion-datetime | ||
presentation="date" | ||
[multiple]="true" | ||
[value]="['2022-06-03', '2022-06-13', '2022-06-29']" | ||
></ion-datetime> | ||
``` |
This file contains hidden or 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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Datetime</title> | ||
<link rel="stylesheet" href="../../common.css" /> | ||
<script src="../../common.js"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@6/dist/ionic/ionic.esm.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@6/css/ionic.bundle.css" /> | ||
<style> | ||
ion-datetime { | ||
width: 350px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<ion-app> | ||
<ion-content> | ||
<div class="container"> | ||
<ion-datetime presentation="date" multiple="true"></ion-datetime> | ||
</div> | ||
</ion-content> | ||
</ion-app> | ||
|
||
<script> | ||
const datetime = document.querySelector('ion-datetime'); | ||
datetime.value = ['2022-06-03', '2022-06-13', '2022-06-29']; | ||
</script> | ||
</body> | ||
</html> |
This file contains hidden or 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,8 @@ | ||
import Playground from '@site/src/components/global/Playground'; | ||
|
||
import javascript from './javascript.md'; | ||
import react from './react.md'; | ||
import vue from './vue.md'; | ||
import angular from './angular.md'; | ||
|
||
<Playground size="medium" code={{ javascript, react, vue, angular }} src="usage/datetime/multiple/demo.html" /> |
This file contains hidden or 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,8 @@ | ||
```html | ||
<ion-datetime presentation="date" multiple="true"></ion-datetime> | ||
|
||
<script> | ||
const datetime = document.querySelector('ion-datetime'); | ||
datetime.value = ['2022-06-03', '2022-06-13', '2022-06-29']; | ||
</script> | ||
``` |
This file contains hidden or 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,20 @@ | ||
```tsx | ||
import React, { useRef, useEffect } from 'react'; | ||
import { IonDatetime } from '@ionic/react'; | ||
|
||
function Example() { | ||
const datetime = useRef<null | HTMLIonDatetimeElement>(null); | ||
|
||
useEffect(() => { | ||
if(!datetime.current) return; | ||
datetime.current.value = ['2022-06-03', '2022-06-13', '2022-06-29']; | ||
}, []); | ||
|
||
return <IonDatetime | ||
ref={datetime} | ||
presentation="date" | ||
multiple={true} | ||
></IonDatetime>; | ||
} | ||
export default Example; | ||
``` |
This file contains hidden or 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,18 @@ | ||
```html | ||
<template> | ||
<ion-datetime | ||
presentation="date" | ||
:multiple="true" | ||
:value="['2022-06-03', '2022-06-13', '2022-06-29']" | ||
></ion-datetime> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { IonDatetime } from '@ionic/vue'; | ||
import { defineComponent } from 'vue'; | ||
|
||
export default defineComponent({ | ||
components: { IonDatetime }, | ||
}); | ||
</script> | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is done to get around this issue, which also applies here: ionic-team/ionic-framework#25041
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.
Should we update that issue to mention it will affect
ion-datetime
withmultiple
? Also, should we add a comment in the playground so in the future when that issue is resolved, we can update this example and remove this code?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.
Good call 👀 I updated the issue and will add a tech debt ticket.
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.
Ticket made: https://ionic-cloud.atlassian.net/browse/FW-1872 I skipped adding the comment since I didn't want it to show up in the actual docs site (and putting it in
demo.html
felt weird when it's not relevant to that), but I think the Jira ticket should be good enough for tracking this.