-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
chore: migrating storybook jsx to typescript #18100 #18133
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,30 +17,25 @@ | |||||
* under the License. | ||||||
*/ | ||||||
|
||||||
/* eslint-disable jsx-a11y/label-has-associated-control */ | ||||||
import React from 'react'; | ||||||
import { formatTime } from '@superset-ui/core'; | ||||||
|
||||||
const propTypes = {}; | ||||||
const defaultProps = {}; | ||||||
|
||||||
class TimeFormatValidator extends React.PureComponent { | ||||||
state: { formatString: string; testValues: any[] } = { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This typing do suggest another change in the file
|
||||||
formatString: '%Y-%m-%d %H:%M:%S', | ||||||
testValues: [ | ||||||
new Date(Date.UTC(1986, 5, 14, 8, 30, 53)), | ||||||
new Date(Date.UTC(2001, 9, 27, 13, 45, 2, 678)), | ||||||
new Date(Date.UTC(2009, 1, 1, 0, 0, 0)), | ||||||
new Date(Date.UTC(2018, 1, 1, 10, 20, 33)), | ||||||
0, | ||||||
null, | ||||||
undefined, | ||||||
], | ||||||
}; | ||||||
|
||||||
constructor(props) { | ||||||
super(props); | ||||||
|
||||||
this.state = { | ||||||
formatString: '%Y-%m-%d %H:%M:%S', | ||||||
testValues: [ | ||||||
new Date(Date.UTC(1986, 5, 14, 8, 30, 53)), | ||||||
new Date(Date.UTC(2001, 9, 27, 13, 45, 2, 678)), | ||||||
new Date(Date.UTC(2009, 1, 1, 0, 0, 0)), | ||||||
new Date(Date.UTC(2018, 1, 1, 10, 20, 33)), | ||||||
0, | ||||||
null, | ||||||
undefined, | ||||||
], | ||||||
}; | ||||||
|
||||||
this.handleFormatChange = this.handleFormatChange.bind(this); | ||||||
} | ||||||
|
||||||
|
@@ -78,14 +73,17 @@ class TimeFormatValidator extends React.PureComponent { | |||||
<div className="col-sm-8"> | ||||||
<div className="form"> | ||||||
<div className="form-group"> | ||||||
<label>Enter D3 time format string: </label> | ||||||
<input | ||||||
id="formatString" | ||||||
className="form-control form-control-lg" | ||||||
type="text" | ||||||
value={formatString} | ||||||
onChange={this.handleFormatChange} | ||||||
/> | ||||||
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */} | ||||||
<label> | ||||||
Enter D3 time format string: | ||||||
<input | ||||||
id="formatString" | ||||||
className="form-control form-control-lg" | ||||||
type="text" | ||||||
value={formatString} | ||||||
onChange={this.handleFormatChange} | ||||||
/> | ||||||
</label> | ||||||
</div> | ||||||
</div> | ||||||
</div> | ||||||
|
@@ -101,8 +99,8 @@ class TimeFormatValidator extends React.PureComponent { | |||||
</tr> | ||||||
</thead> | ||||||
<tbody> | ||||||
{testValues.map(v => ( | ||||||
<tr key={v}> | ||||||
{testValues.map((v, index) => ( | ||||||
<tr key={index}> | ||||||
<td> | ||||||
<code> | ||||||
{v instanceof Date ? v.toUTCString() : `${v}`} | ||||||
|
@@ -122,9 +120,6 @@ class TimeFormatValidator extends React.PureComponent { | |||||
} | ||||||
} | ||||||
|
||||||
TimeFormatValidator.propTypes = propTypes; | ||||||
TimeFormatValidator.defaultProps = defaultProps; | ||||||
|
||||||
export default { | ||||||
title: 'Core Packages/@superset-ui-time-format', | ||||||
}; | ||||||
|
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.
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.
Done