Skip to content

Commit 99b2691

Browse files
authored
πŸ’„ background-blur for legibility (#42)
* background-blur for legibility * v0.3.2
1 parent 77d671a commit 99b2691

File tree

5 files changed

+114
-25
lines changed

5 files changed

+114
-25
lines changed

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.3.1",
2+
"version": "0.3.2",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",

β€Žsrc/alert/styles.tsβ€Ž

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,41 @@ import { css } from '@emotion/core';
22
import { transparentize } from 'polished';
33
import theme from '../theme';
44

5-
export const warningCSS = css`
6-
border: 1px solid ${theme.colors.statusWarning};
7-
background-color: ${transparentize(0.85, theme.colors.statusWarning)};
8-
color: ${theme.colors.statusWarning};
5+
export const baseSeverityCSS = css`
6+
backdrop-filter: blur(4px);
97
`;
8+
export const warningCSS = css(
9+
baseSeverityCSS,
10+
css`
11+
border: 1px solid ${theme.colors.statusWarning};
12+
background-color: ${transparentize(0.85, theme.colors.statusWarning)};
13+
color: ${theme.colors.statusWarning};
14+
`
15+
);
1016

11-
export const infoCSS = css`
12-
border: 1px solid ${theme.colors.statusInfo};
13-
background-color: ${transparentize(0.85, theme.colors.statusInfo)};
14-
color: ${theme.colors.statusInfo};
15-
`;
17+
export const infoCSS = css(
18+
baseSeverityCSS,
19+
css`
20+
border: 1px solid ${theme.colors.statusInfo};
21+
background-color: ${transparentize(0.85, theme.colors.statusInfo)};
22+
color: ${theme.colors.statusInfo};
23+
`
24+
);
1625

17-
export const dangerCSS = css`
18-
border: 1px solid ${theme.colors.statusDanger};
19-
background-color: ${transparentize(0.85, theme.colors.statusDanger)};
20-
color: ${theme.colors.statusDanger};
21-
`;
26+
export const dangerCSS = css(
27+
baseSeverityCSS,
28+
css`
29+
border: 1px solid ${theme.colors.statusDanger};
30+
background-color: ${transparentize(0.85, theme.colors.statusDanger)};
31+
color: ${theme.colors.statusDanger};
32+
`
33+
);
2234

23-
export const successCSS = css`
24-
border: 1px solid ${theme.colors.statusSuccess};
25-
background-color: ${transparentize(0.85, theme.colors.statusSuccess)};
26-
color: ${theme.colors.statusSuccess};
27-
`;
35+
export const successCSS = css(
36+
baseSeverityCSS,
37+
css`
38+
border: 1px solid ${theme.colors.statusSuccess};
39+
background-color: ${transparentize(0.85, theme.colors.statusSuccess)};
40+
color: ${theme.colors.statusSuccess};
41+
`
42+
);

β€Žstories/Alert.stories.tsxβ€Ž

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,3 @@ export const gallery = () => {
157157
</div>
158158
);
159159
};
160-
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
161-
// https://storybook.js.org/docs/react/workflows/unit-testing
162-
export const Warning = Template.bind({});
163-
164-
Warning.args = { variant: 'warning', children: 'Alert text goes here' };

β€Žstories/Gallery.stories.tsxβ€Ž

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React from 'react';
2+
import { css } from '@emotion/core';
3+
import { Meta, Story } from '@storybook/react';
4+
import { Alert, Card, useNotification, Button } from '../src';
5+
6+
// @ts-ignore
7+
import chartFile from './images/chart.png';
8+
9+
const meta: Meta = {
10+
title: 'Gallery',
11+
parameters: {
12+
controls: { expanded: true },
13+
design: {
14+
type: 'figma',
15+
url:
16+
'https://www.figma.com/file/5mMInYH9JdJY389s8iBVQm/Component-Library?node-id=1398%3A4061',
17+
},
18+
},
19+
};
20+
21+
export default meta;
22+
23+
const Template: Story = args => {
24+
const [notify, holder] = useNotification();
25+
return (
26+
<div>
27+
<Card
28+
title="Prediction Volume"
29+
bodyStyle={{ padding: 0 }}
30+
extra={
31+
<Button
32+
variant="default"
33+
onClick={() => {
34+
notify({
35+
variant: 'success',
36+
title: 'Awesome!',
37+
message: 'Things worked as expected',
38+
action: {
39+
text: 'Try This',
40+
onClick: () => {},
41+
},
42+
});
43+
}}
44+
>
45+
Notify
46+
</Button>
47+
}
48+
>
49+
<div
50+
css={css`
51+
position: relative;
52+
.ac-alert {
53+
position: absolute;
54+
left: 0;
55+
right: 0;
56+
}
57+
`}
58+
>
59+
<Alert variant="info" banner title="Heads up">
60+
Your predictions may be delayed by up to 10 minutes
61+
</Alert>
62+
63+
<img
64+
src={chartFile}
65+
alt="chart image"
66+
css={css`
67+
margin: 24px;
68+
`}
69+
/>
70+
</div>
71+
</Card>
72+
{holder}
73+
</div>
74+
);
75+
};
76+
77+
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
78+
// https://storybook.js.org/docs/react/workflows/unit-testing
79+
export const Default = Template.bind({});

β€Žstories/images/chart.pngβ€Ž

74.2 KB
Loading

0 commit comments

Comments
Β (0)