-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from PayGreen/pgf-732-fix-buttons-disabled-style
PGF-732: disabled Button and DaButton without hover style (fix)
- Loading branch information
Showing
10 changed files
with
102 additions
and
86 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 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 |
---|---|---|
@@ -1,58 +1,50 @@ | ||
import { css } from 'styled-components'; | ||
import { | ||
buttonColors, | ||
enableType | ||
} from './constants'; | ||
|
||
const enabled = css` | ||
button:hover &, | ||
button:active &, | ||
button:focus &, | ||
a:hover &, | ||
a:active &, | ||
a:focus & { | ||
&::before, | ||
&::after { | ||
opacity: 1; | ||
} | ||
import { buttonColors, enableType, opacity } from './constants'; | ||
|
||
&::before { | ||
top: 0; | ||
left: 0; | ||
} | ||
const disabledStyle = css` | ||
cursor: not-allowed; | ||
&::after { | ||
bottom: 0; | ||
right: 0; | ||
} | ||
/* !important needed to override hover style */ | ||
&::before, | ||
&::after { | ||
opacity: ${props => opacity[props.colorType]} !important; | ||
} | ||
`; | ||
const disabled = css` | ||
cursor: not-allowed; | ||
&::before { | ||
top: -${props => props.theme.button.shift} !important; | ||
left: -${props => props.theme.button.shift} !important; | ||
} | ||
&::after { | ||
bottom: -${props => props.theme.button.shift} !important; | ||
right: -${props => props.theme.button.shift} !important; | ||
} | ||
`; | ||
|
||
const templateStyle = { | ||
fill: css` | ||
color: ${props => buttonColors.text.fill[props.colorType][enableType(props)]}; | ||
color: ${props => | ||
buttonColors.text.fill[props.colorType][enableType(props)]}; | ||
&::before, | ||
&::after { | ||
background-color: ${props => buttonColors.bg.fill[props.colorType][enableType(props)]}; | ||
background-color: ${props => | ||
buttonColors.bg.fill[props.colorType][enableType(props)]}; | ||
} | ||
`, | ||
line: css` | ||
color: ${props => buttonColors.text.line[props.colorType][enableType(props)]}; | ||
color: ${props => | ||
buttonColors.text.line[props.colorType][enableType(props)]}; | ||
&::before, | ||
&::after { | ||
border: solid ${props => props.theme.line} ${props => buttonColors.bg.line[props.colorType][enableType(props)]}; | ||
border-style: solid; | ||
border-width: ${props => props.theme.line}; | ||
border-color: ${props => | ||
buttonColors.bg.line[props.colorType][enableType(props)]}; | ||
} | ||
`, | ||
}; | ||
|
||
export { | ||
enabled, | ||
disabled, | ||
templateStyle | ||
}; | ||
export { disabledStyle, templateStyle }; |
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
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
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
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