-
Notifications
You must be signed in to change notification settings - Fork 2.9k
DatePicker MergeStyles step 2 - Converts scss to js styles #5362
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
Changes from 11 commits
3813de8
4ef49bf
ff1cdd1
7867df2
4fb2b33
efb94d4
ed7ff40
e923dbd
c3fe7c4
f3209a5
79a4c25
1fa4871
fec4744
f22cb19
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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "DatePicker MergeStyles step 2 - Converts scss to js styles", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "office-ui-fabric-react", | ||
| "email": "v-jescla@microsoft.com" | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,59 @@ | ||
| import { IDatePickerStyleProps, IDatePickerStyles } from './DatePicker.types'; | ||
| import { IStyle, normalize, getGlobalClassNames, FontSizes } from '../../Styling'; | ||
|
|
||
| export const getStyles = (props: IDatePickerStyleProps): IDatePickerStyles => { | ||
| const { className } = props; | ||
| const GlobalClassNames = { | ||
| root: 'ms-DatePicker', | ||
| callout: 'ms-DatePicker-callout', | ||
| withLabel: 'ms-DatePicker-event--with-label', | ||
| withoutLabel: 'ms-DatePicker-event--without-label', | ||
| disabled: 'msDatePickerDisabled ' | ||
| }; | ||
|
|
||
| export const styles = (props: IDatePickerStyleProps): IDatePickerStyles => { | ||
| const { className, theme, disabled, label, isDatePickerShown } = props; | ||
| const { palette } = theme; | ||
| const classNames = getGlobalClassNames(GlobalClassNames, theme); | ||
|
|
||
| const DatePickerEvent: IStyle = { | ||
| color: palette.neutralSecondary, | ||
| fontSize: FontSizes.icon, | ||
| lineHeight: '18px', | ||
| pointerEvents: 'none', | ||
| position: 'absolute', | ||
| right: '9px' | ||
| }; | ||
|
|
||
| return { | ||
| root: [ | ||
| 'ms-DatePicker', | ||
| root: [classNames.root, isDatePickerShown && 'is-open', normalize, {}, className], | ||
|
Contributor
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. Shouldn't need the empty object here |
||
| textField: [ | ||
| { | ||
| // Insert css properties | ||
| }, | ||
| className | ||
| position: 'relative', | ||
| selectors: { | ||
| '& input[readonly]': { | ||
| cursor: 'pointer' | ||
| }, | ||
| input: { | ||
| selectors: { | ||
| '::-ms-clear': { | ||
| display: 'none' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| callout: [classNames.callout], | ||
| icon: [ | ||
| DatePickerEvent, | ||
| !label && [classNames.withoutLabel, { top: '7px' }], | ||
| label && [classNames.withLabel, { bottom: '5px' }], | ||
| !disabled && [ | ||
| classNames.disabled, | ||
| { | ||
| pointerEvents: 'initial', | ||
| cursor: 'pointer' | ||
| } | ||
| ] | ||
| ] | ||
|
|
||
| // Insert className styles | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| import { styled } from '../../Utilities'; | ||
| import { IDatePickerProps, IDatePickerStyleProps, IDatePickerStyles } from './DatePicker.types'; | ||
| import { DatePickerBase } from './DatePicker.base'; | ||
| import { getStyles } from './DatePicker.styles'; | ||
| import { styles } from './DatePicker.styles'; | ||
|
|
||
| /** | ||
| * DatePicker description | ||
| */ | ||
| export const DatePicker = styled<IDatePickerProps, IDatePickerStyleProps, IDatePickerStyles>( | ||
| DatePickerBase, | ||
| getStyles, | ||
| styles, | ||
| undefined, | ||
| { scope: 'DatePicker' } | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| exports[`DatePicker renders default DatePicker correctly 1`] = ` | ||
| <div | ||
| className="ms-DatePicker" | ||
| className={undefined} | ||
|
Collaborator
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 should not be undefined
Contributor
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. Per our Teams chat, |
||
| > | ||
| <div> | ||
| <div | ||
|
|
@@ -39,7 +39,7 @@ exports[`DatePicker renders default DatePicker correctly 1`] = ` | |
| <i | ||
| aria-hidden={true} | ||
| className= | ||
| ms-DatePicker-event--without-label | ||
|
|
||
|
Contributor
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. Hmm, I feel like this className should still be here but I don't see any obvious issues with the code |
||
| { | ||
| -moz-osx-font-smoothing: grayscale; | ||
| -webkit-font-smoothing: antialiased; | ||
|
|
||
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.
👍