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

💄 background-blur for legibility #42

Merged
merged 2 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
53 changes: 34 additions & 19 deletions src/alert/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,41 @@ import { css } from '@emotion/core';
import { transparentize } from 'polished';
import theme from '../theme';

export const warningCSS = css`
border: 1px solid ${theme.colors.statusWarning};
background-color: ${transparentize(0.85, theme.colors.statusWarning)};
color: ${theme.colors.statusWarning};
export const baseSeverityCSS = css`
backdrop-filter: blur(4px);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woah I've never used backdrop-filter before 😮

`;
export const warningCSS = css(
baseSeverityCSS,
css`
border: 1px solid ${theme.colors.statusWarning};
background-color: ${transparentize(0.85, theme.colors.statusWarning)};
color: ${theme.colors.statusWarning};
`
);

export const infoCSS = css`
border: 1px solid ${theme.colors.statusInfo};
background-color: ${transparentize(0.85, theme.colors.statusInfo)};
color: ${theme.colors.statusInfo};
`;
export const infoCSS = css(
baseSeverityCSS,
css`
border: 1px solid ${theme.colors.statusInfo};
background-color: ${transparentize(0.85, theme.colors.statusInfo)};
color: ${theme.colors.statusInfo};
`
);

export const dangerCSS = css`
border: 1px solid ${theme.colors.statusDanger};
background-color: ${transparentize(0.85, theme.colors.statusDanger)};
color: ${theme.colors.statusDanger};
`;
export const dangerCSS = css(
baseSeverityCSS,
css`
border: 1px solid ${theme.colors.statusDanger};
background-color: ${transparentize(0.85, theme.colors.statusDanger)};
color: ${theme.colors.statusDanger};
`
);

export const successCSS = css`
border: 1px solid ${theme.colors.statusSuccess};
background-color: ${transparentize(0.85, theme.colors.statusSuccess)};
color: ${theme.colors.statusSuccess};
`;
export const successCSS = css(
baseSeverityCSS,
css`
border: 1px solid ${theme.colors.statusSuccess};
background-color: ${transparentize(0.85, theme.colors.statusSuccess)};
color: ${theme.colors.statusSuccess};
`
);
5 changes: 0 additions & 5 deletions stories/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,3 @@ export const gallery = () => {
</div>
);
};
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
// https://storybook.js.org/docs/react/workflows/unit-testing
export const Warning = Template.bind({});

Warning.args = { variant: 'warning', children: 'Alert text goes here' };
79 changes: 79 additions & 0 deletions stories/Gallery.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from 'react';
import { css } from '@emotion/core';
import { Meta, Story } from '@storybook/react';
import { Alert, Card, useNotification, Button } from '../src';

// @ts-ignore
import chartFile from './images/chart.png';

const meta: Meta = {
title: 'Gallery',
parameters: {
controls: { expanded: true },
design: {
type: 'figma',
url:
'https://www.figma.com/file/5mMInYH9JdJY389s8iBVQm/Component-Library?node-id=1398%3A4061',
},
},
};

export default meta;

const Template: Story = args => {
const [notify, holder] = useNotification();
return (
<div>
<Card
title="Prediction Volume"
bodyStyle={{ padding: 0 }}
extra={
<Button
variant="default"
onClick={() => {
notify({
variant: 'success',
title: 'Awesome!',
message: 'Things worked as expected',
action: {
text: 'Try This',
onClick: () => {},
},
});
}}
>
Notify
</Button>
}
>
<div
css={css`
position: relative;
.ac-alert {
position: absolute;
left: 0;
right: 0;
}
`}
>
<Alert variant="info" banner title="Heads up">
Your predictions may be delayed by up to 10 minutes
</Alert>

<img
src={chartFile}
alt="chart image"
css={css`
margin: 24px;
`}
/>
</div>
</Card>
{holder}
</div>
);
};

// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
// https://storybook.js.org/docs/react/workflows/unit-testing
export const Default = Template.bind({});
Binary file added stories/images/chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.