Skip to content

Commit

Permalink
fix: add title prop to #date-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Aug 12, 2019
1 parent bf657bc commit 74da4ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/dnb-ui-lib/src/components/date-picker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const renderProps = {

export const propTypes = {
id: PropTypes.string,
title: PropTypes.string,
date: PropTypes.oneOfType([
PropTypes.instanceOf(Date),
PropTypes.string
Expand Down Expand Up @@ -134,6 +135,7 @@ export const propTypes = {

export const defaultProps = {
id: null,
title: null,
date: null,
start_date: null,
end_date: null,
Expand Down Expand Up @@ -547,6 +549,7 @@ export default class DatePicker extends PureComponent {

const {
label,
title,
label_direction,
only_month,
hide_navigation_buttons,
Expand Down Expand Up @@ -661,6 +664,7 @@ export default class DatePicker extends PureComponent {
<span className="dnb-date-picker__shell">
<DatePickerInput
id={id}
title={title}
disabled={isTrue(disabled)}
maskOrder={mask_order}
maskPlaceholder={mask_placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { isDisabled } from './DatePickerCalc'

export const propTypes = {
id: PropTypes.string,
title: PropTypes.string,
maskOrder: PropTypes.string,
maskPlaceholder: PropTypes.string,
separatorRexExp: PropTypes.instanceOf(RegExp),
Expand All @@ -50,6 +51,7 @@ export const propTypes = {

export const defaultProps = {
id: null,
title: null,
maskOrder: 'dd/mm/yyyy',
maskPlaceholder: 'dd/mm/åååå',
separatorRexExp: /[-/ ]/g,
Expand Down Expand Up @@ -496,6 +498,7 @@ export default class DatePickerInput extends PureComponent {
render() {
const {
id,
title,

submitAttributes,
range /* eslint-disable-line */,
Expand Down Expand Up @@ -540,7 +543,7 @@ export default class DatePickerInput extends PureComponent {
id={id}
disabled={disabled}
className={opened ? 'dnb-button--active' : null}
// title={submit_button_title} // Not implemented yet
title={title}
type="button"
icon="calendar"
variant="secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
status_state="error"
submit_button_text="Ok"
sync={true}
title={null}
>
<span
className="dnb-date-picker dnb-date-picker__status--error dnb-date-picker--hidden dnb-date-picker--show-input dnb-date-picker--show-footer"
Expand Down Expand Up @@ -119,6 +120,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
"aria-expanded": false,
}
}
title={null}
>
<Input
align={null}
Expand Down
1 change: 1 addition & 0 deletions packages/dnb-ui-lib/stories/components/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default [
label="Date Picker 1:"
right="small"
date="1981-01-15"
title="My Button"
/>
<DatePicker
label="Date Picker 2:"
Expand Down

0 comments on commit 74da4ba

Please sign in to comment.