-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix label color of feedback button (#2959)
* Fix label color of feedback button * update yarn.lock
- Loading branch information
Showing
3 changed files
with
158 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
import styled from 'styled-components'; | ||
import { useContext } from 'react'; | ||
import styled, { ThemeContext } from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
import { Box, Button } from 'grommet'; | ||
|
||
const PositionedBox = styled(Box)` | ||
position: fixed; | ||
bottom: 0px; | ||
border-radius: 6px; | ||
right: 0px; | ||
z-index: 10; | ||
`; | ||
|
||
export const FeedbackButton = ({ elevation, margin, ...buttonProps }) => ( | ||
<PositionedBox elevation={elevation} margin={margin}> | ||
<Button {...buttonProps} /> | ||
</PositionedBox> | ||
); | ||
// temp fix until this theme issue is resolved: | ||
// https://github.com/grommet/grommet-theme-hpe/issues/283 | ||
const StyledButton = styled(Button)` | ||
color: ${props => props.theme.global.colors['text-strong'].dark}; | ||
`; | ||
|
||
export const FeedbackButton = ({ elevation, margin, ...buttonProps }) => { | ||
const theme = useContext(ThemeContext); | ||
return ( | ||
<PositionedBox elevation={elevation} margin={margin}> | ||
<StyledButton theme={theme} {...buttonProps} /> | ||
</PositionedBox> | ||
); | ||
}; | ||
|
||
FeedbackButton.propTypes = { | ||
elevation: PropTypes.string, | ||
margin: PropTypes.shape({}), | ||
}; |
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
Oops, something went wrong.