-
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.
chore(DateInput): extract abstract class tor Custom Control (#20)
- Loading branch information
1 parent
5125210
commit 5be26e3
Showing
6 changed files
with
44 additions
and
60 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import { CustomControlBase } from "../../utils/CustomControl.ts"; | ||
import DateInput from "./DateInput"; | ||
|
||
import { DateChangeHandler } from "@splunk/react-ui/Date"; | ||
|
||
export default class DateInputClass extends CustomControlBase { | ||
onDateChange: DateChangeHandler = (_event, data) => { | ||
this.setValue(data.value); | ||
}; | ||
|
||
render() { | ||
const dateValue = this.data.value; | ||
const date = | ||
typeof dateValue === "string" && dateValue.length !== 0 | ||
? dateValue | ||
: undefined; | ||
|
||
ReactDOM.render( | ||
<DateInput value={date} onChange={this.onDateChange} />, | ||
this.el, | ||
); | ||
} | ||
} |
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