From 563b06925dc241049ef53885025f50b64df318ed Mon Sep 17 00:00:00 2001 From: Jill Yan Date: Wed, 18 Sep 2019 16:25:09 +0800 Subject: [PATCH] Jill(feat) use tertiary button for date and navigation button in date picker (#2397) * use ghost buttons * use variables * replace icon chevron by arrow * wrong tint usage * update test snap * chore(ci): prettier * month pressed style * chore(ci): prettier * remove height * use tertiary button for month-year button in date picker * chore(ci): prettier * chore(ci): update libs security audit * chore(ci): update libs security audit --- .../DatePicker/DatePicker.component.js | 2 + .../pickers/DatePicker/DatePicker.scss | 4 +- .../__snapshots__/DatePicker.test.js.snap | 60 +++++++++---------- .../pickers/MonthPicker/MonthPicker.scss | 5 +- .../DateTimePickers/shared/styles/mixins.scss | 4 +- .../DateTimeView/DateTimeView.component.js | 9 +-- .../__snapshots__/DateTimeView.test.js.snap | 16 ++--- .../HeaderTitle/HeaderTitle.component.js | 15 ++--- .../views/HeaderTitle/HeaderTitle.scss | 2 +- .../views/HeaderTitle/HeaderTitle.test.js | 4 +- .../__snapshots__/HeaderTitle.test.js.snap | 10 ++-- .../MonthYearView/MonthYearView.component.js | 2 +- .../__snapshots__/MonthYearView.test.js.snap | 2 +- .../views/ViewLayout/ViewLayout.scss | 12 ++-- 14 files changed, 77 insertions(+), 70 deletions(-) diff --git a/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.component.js b/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.component.js index cde8874bdb0..de5139f1e1e 100644 --- a/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.component.js +++ b/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.component.js @@ -108,6 +108,8 @@ class DatePicker extends React.PureComponent { [theme.today]: today, }, 'tc-date-picker-day', + 'btn-tertiary', + 'btn-default', ); let ariaLabel = format(date, 'dddd DD MMMM YYYY', pickerLocale); diff --git a/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.scss b/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.scss index 1d65917ef3a..a1752df657a 100644 --- a/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.scss +++ b/packages/components/src/DateTimePickers/pickers/DatePicker/DatePicker.scss @@ -35,7 +35,9 @@ .calendar-day { &.today { - background-color: $concrete; + background-color: tint($lochmara, 90%); + color: $lochmara; + border: solid 1px $lochmara; } @include picker-action; diff --git a/packages/components/src/DateTimePickers/pickers/DatePicker/__snapshots__/DatePicker.test.js.snap b/packages/components/src/DateTimePickers/pickers/DatePicker/__snapshots__/DatePicker.test.js.snap index f9a643e77f1..1bed5c1e8c4 100644 --- a/packages/components/src/DateTimePickers/pickers/DatePicker/__snapshots__/DatePicker.test.js.snap +++ b/packages/components/src/DateTimePickers/pickers/DatePicker/__snapshots__/DatePicker.test.js.snap @@ -144,7 +144,7 @@ exports[`DatePicker should render a DatePicker 1`] = ` > - ); + return ; } return ( diff --git a/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.scss b/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.scss index 2ca866f6cd1..0fd370a721f 100644 --- a/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.scss +++ b/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.scss @@ -5,7 +5,7 @@ justify-content: center; align-items: center; text-transform: uppercase; - font-weight: 600; + font-weight: $font-weight-semi-bold; :global(.dropdown-menu) { min-width: 63px; diff --git a/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.test.js b/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.test.js index c866a4ef189..b41f1815781 100644 --- a/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.test.js +++ b/packages/components/src/DateTimePickers/views/HeaderTitle/HeaderTitle.test.js @@ -23,7 +23,7 @@ describe('HeaderTitle', () => { ); // Then - expect(wrapper.name()).toEqual('button'); + expect(wrapper.name()).toEqual('Action'); expect(wrapper.getElement()).toMatchSnapshot(); }); @@ -44,6 +44,6 @@ describe('HeaderTitle', () => { .first() .props().label, ).toEqual('2001'); - expect(wrapperButton.text()).toBe('December 2002'); + expect(wrapperButton.prop('label')).toBe('December 2002'); }); }); diff --git a/packages/components/src/DateTimePickers/views/HeaderTitle/__snapshots__/HeaderTitle.test.js.snap b/packages/components/src/DateTimePickers/views/HeaderTitle/__snapshots__/HeaderTitle.test.js.snap index 821e626c825..d0e57604916 100644 --- a/packages/components/src/DateTimePickers/views/HeaderTitle/__snapshots__/HeaderTitle.test.js.snap +++ b/packages/components/src/DateTimePickers/views/HeaderTitle/__snapshots__/HeaderTitle.test.js.snap @@ -1,13 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`HeaderTitle should render a button 1`] = ` - +/> `; exports[`HeaderTitle should render a span and ActionDropdown 1`] = ` diff --git a/packages/components/src/DateTimePickers/views/MonthYearView/MonthYearView.component.js b/packages/components/src/DateTimePickers/views/MonthYearView/MonthYearView.component.js index 56c51652581..3a70dfb4dd6 100644 --- a/packages/components/src/DateTimePickers/views/MonthYearView/MonthYearView.component.js +++ b/packages/components/src/DateTimePickers/views/MonthYearView/MonthYearView.component.js @@ -17,7 +17,7 @@ function MonthYearView(props) { icon="talend-arrow-left" onClick={props.onBackClick} tabIndex={props.allowFocus ? 0 : -1} - link + className="btn-tertiary btn-info" /> ), middleElement: ( diff --git a/packages/components/src/DateTimePickers/views/MonthYearView/__snapshots__/MonthYearView.test.js.snap b/packages/components/src/DateTimePickers/views/MonthYearView/__snapshots__/MonthYearView.test.js.snap index e59abcfd0ae..eb7994628ae 100644 --- a/packages/components/src/DateTimePickers/views/MonthYearView/__snapshots__/MonthYearView.test.js.snap +++ b/packages/components/src/DateTimePickers/views/MonthYearView/__snapshots__/MonthYearView.test.js.snap @@ -14,9 +14,9 @@ exports[`MonthYearView should render 1`] = ` Object { "leftElement": , diff --git a/packages/components/src/DateTimePickers/views/ViewLayout/ViewLayout.scss b/packages/components/src/DateTimePickers/views/ViewLayout/ViewLayout.scss index cfec43fb6a6..acd9a6c84f6 100644 --- a/packages/components/src/DateTimePickers/views/ViewLayout/ViewLayout.scss +++ b/packages/components/src/DateTimePickers/views/ViewLayout/ViewLayout.scss @@ -6,16 +6,14 @@ .header { display: flex; - height: 5rem; + justify-content: space-between; margin-bottom: $padding-small; - .left, - .right { - flex: 1; + .left { + padding-left: $padding-small; } - - .middle { - flex: 4; + .right { + padding-right: $padding-small; } :global(.btn-icon-only) {