Skip to content
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

Use correct color token for action in snackbar #538

Merged
merged 1 commit into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions apps/storybook-react/stories/Snackbar.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import { Snackbar, Button } from '@equinor/eds-core-react'

const { SnackbarAction } = Snackbar
import styled from 'styled-components'
import { tokens } from '@equinor/eds-tokens'

const {
colors: {
infographic: {
primary__moss_green_34: { rgba: buttonColor },
},
},
} = tokens

const Wrapper = styled.div`
display: grid;
Expand All @@ -21,12 +12,6 @@ const Wrapper = styled.div`
padding-bottom: 8rem;
grid-gap: 2rem;
`
// At the moment you'll have to override the default ghost button with this slightly lighter color for better contrast on dark background
const StyledButton = styled(Button)`
:not(:hover) {
color: ${buttonColor};
}
`

export default {
title: 'Components/Snackbar',
Expand Down Expand Up @@ -62,7 +47,7 @@ export const Example = () => {
>
Your changes was saved
<SnackbarAction>
<StyledButton variant="ghost">Undo</StyledButton>
<Button variant="ghost">Undo</Button>
</SnackbarAction>
</Snackbar>
</div>
Expand Down
9 changes: 7 additions & 2 deletions libraries/core-react/src/Snackbar/Snackbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { typographyTemplate } from '../_common/templates'
const StyledSnackbar = styled.div.attrs(() => ({
role: 'alert',
}))`

position: fixed;
left: ${tokens.spacings.left};
bottom: ${tokens.spacings.bottom};
Expand All @@ -17,14 +17,19 @@ const StyledSnackbar = styled.div.attrs(() => ({
${typographyTemplate(tokens.text.typography)}
color: ${tokens.text.color};
box-shadow: ${tokens.boxShadow};
min-height: ${tokens.minHeight};
min-height: ${tokens.minHeight};
box-sizing: border-box;
left: 50%;
transform: translateX(-50%);
@media (min-width: ${({ leftAlignFrom }) => leftAlignFrom}) {
left: auto;
transform: none;
}

a,
button {
color: ${tokens.buttonColor}
}
`

export const Snackbar = ({
Expand Down
4 changes: 4 additions & 0 deletions libraries/core-react/src/Snackbar/Snackbar.tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const {
text: {
static_icons__primary_white: { hex: color },
},
interactive: {
link_in_snackbars: { hex: buttonColor },
},
},
spacings: {
comfortable: { medium: spacingMedium },
Expand All @@ -36,4 +39,5 @@ export const snackbar = {
},
},
borderRadius: '4px',
buttonColor,
}