-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new examples [MDS-648 MDS-744] (#2431)
* feat: new examples [MDS-648 MDS-744] * add input date custom examples * add control example * fix tests * fix tests
- Loading branch information
Showing
5 changed files
with
299 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Input } from '@heathmont/moon-core-tw'; | ||
import { useState } from 'react'; | ||
|
||
const Example = () => { | ||
const [color, setColor] = useState('FFFFFF'); | ||
return ( | ||
<div className="w-full"> | ||
<Input | ||
aria-label="controled" | ||
value={color} | ||
onChange={(e) => { | ||
setColor(e.target.value); | ||
}} | ||
/> | ||
<p className="text-moon-18 pt-2"> | ||
<b>Result:</b> {color} | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Example; |
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,56 @@ | ||
//This exemple should be discussed about separate date-picker component | ||
import { Input, Label } from '@heathmont/moon-core-tw'; | ||
import { TimeCalendarDate } from '@heathmont/moon-icons-tw'; | ||
|
||
const Example = () => ( | ||
<> | ||
<div className="flex flex-col lg:flex-row justify-around items-end w-full gap-2"> | ||
<div className="w-full"> | ||
<Label>Date with placeholder</Label> | ||
<div className="relative"> | ||
<Input | ||
type="text" | ||
aria-label="Date" | ||
placeholder="mm.dd.yyyy" | ||
className="[&[type='date']::-webkit-calendar-picker-indicator]:bg-none cursor-default [&_.datetime-calendar-button-svg]:hidden" | ||
onFocus={(e) => { | ||
e.target.type = 'date'; | ||
e.target?.showPicker(); | ||
}} | ||
onBlur={(e) => (e.target.type = 'text')} | ||
/> | ||
<span className="pointer-events-none absolute top-1/2 right-3 h-6 -mt-3 w-10 bg-goku z-5"> | ||
<TimeCalendarDate className="text-bulma text-moon-24 absolute top-1/2 right-0 -mt-3" /> | ||
</span> | ||
</div> | ||
</div> | ||
<div className="w-full"> | ||
<Label htmlFor="time-type">Time</Label> | ||
<div className="relative"> | ||
<Input | ||
type="text" | ||
id="time-type" | ||
placeholder="Time" | ||
className="[&[type='date']::-webkit-calendar-picker-indicator]:bg-none cursor-default" | ||
onFocus={(e) => { | ||
e.target.type = 'time'; | ||
e.target?.showPicker(); | ||
}} | ||
onBlur={(e) => (e.target.type = 'text')} | ||
/> | ||
<TimeCalendarDate className="text-bulma text-moon-24 absolute top-1/2 right-3 z-5 -mt-3" /> | ||
</div> | ||
</div> | ||
<div className="w-full"> | ||
<Label htmlFor="datetimelocal-type">Datetime local</Label> | ||
<Input | ||
type="datetime-local" | ||
id="datetimelocal-type" | ||
className="[&[type='date']::-webkit-calendar-picker-indicator]:bg-none cursor-default [&_#calendar-button]:hidden" | ||
/> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
|
||
export default Example; |
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