@bitrise/bitkit 10.5.1 → 10.6.0-alpha-notification.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Components/ColorButton/ColorButton.tsx +1 -1
- package/src/Components/Notification/Notification.tsx +1 -1
- package/src/Components/Ribbon/Ribbon.tsx +2 -3
- package/src/index.ts +3 -0
- package/src/old.ts +0 -3
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/Old/Notification/Notification.css +0 -34
- package/src/Old/Notification/Notification.test.tsx +0 -33
- package/src/Old/Notification/Notification.tsx +0 -69
- package/src/Old/Notification/__snapshots__/Notification.test.tsx.snap +0 -78
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
.Notification {
|
|
2
|
-
border: 0.0625rem solid transparent;
|
|
3
|
-
border-radius: var(--size--x2);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.Notification--type-alert {
|
|
7
|
-
border-color: var(--color-red--3);
|
|
8
|
-
background-color: var(--color-red--1);
|
|
9
|
-
color: var(--color-red--4);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.Notification--type-inform {
|
|
13
|
-
border-color: var(--color-blue--2);
|
|
14
|
-
background-color: var(--color-blue--1);
|
|
15
|
-
color: var(--color-blue--4);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.Notification--type-progress {
|
|
19
|
-
border-color: var(--color-grape--2);
|
|
20
|
-
background-color: var(--color-grape--1);
|
|
21
|
-
color: var(--color-eggplant);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.Notification--type-success {
|
|
25
|
-
border-color: var(--color-green--2);
|
|
26
|
-
background-color: var(--color-green--1);
|
|
27
|
-
color: var(--color-green--5);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.Notification--type-warning {
|
|
31
|
-
border-color: var(--color-yellow--3);
|
|
32
|
-
background-color: var(--color-yellow--1);
|
|
33
|
-
color: var(--color-yellow--5);
|
|
34
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { shallow } from 'enzyme';
|
|
2
|
-
import { shallowToJson } from 'enzyme-to-json';
|
|
3
|
-
import Notification from './Notification';
|
|
4
|
-
|
|
5
|
-
describe('Notification', () => {
|
|
6
|
-
test('default template', () => {
|
|
7
|
-
expect(shallowToJson(shallow(<Notification type="alert">Content</Notification>))).toMatchSnapshot();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test('default icon can be overridden', () => {
|
|
11
|
-
expect(
|
|
12
|
-
shallowToJson(
|
|
13
|
-
shallow(
|
|
14
|
-
<Notification icon="Bell" type="alert">
|
|
15
|
-
Content
|
|
16
|
-
</Notification>,
|
|
17
|
-
),
|
|
18
|
-
),
|
|
19
|
-
).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('with onRemove has a close icon', () => {
|
|
23
|
-
expect(
|
|
24
|
-
shallowToJson(
|
|
25
|
-
shallow(
|
|
26
|
-
<Notification onRemove={() => {}} type="alert">
|
|
27
|
-
Content
|
|
28
|
-
</Notification>,
|
|
29
|
-
),
|
|
30
|
-
),
|
|
31
|
-
).toMatchSnapshot();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import Flex, { Props as FlexProps } from '../Flex/Flex';
|
|
4
|
-
import Icon, { TypeIconName } from '../../Components/Icon/Icon';
|
|
5
|
-
import Link from '../../Components/Link/Link';
|
|
6
|
-
import ProgressSpinner from '../Progress/ProgressSpinner';
|
|
7
|
-
import './Notification.css';
|
|
8
|
-
|
|
9
|
-
type TypeNotificationType = 'alert' | 'inform' | 'progress' | 'success' | 'warning';
|
|
10
|
-
|
|
11
|
-
export interface Props extends FlexProps {
|
|
12
|
-
/**
|
|
13
|
-
* A callback to remove the notification, that when provided will
|
|
14
|
-
* render a clickable cross, that when clicked will call the given
|
|
15
|
-
* function.
|
|
16
|
-
*/
|
|
17
|
-
onRemove?: (e: React.SyntheticEvent) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Name of one of the Bitkit icons that will accompany the message
|
|
20
|
-
* of the notification. By default, some of the notification
|
|
21
|
-
* types have icons, but these can be overridden.
|
|
22
|
-
*/
|
|
23
|
-
icon?: TypeIconName;
|
|
24
|
-
/**
|
|
25
|
-
* The type of the notification that affects the styling and content.
|
|
26
|
-
*/
|
|
27
|
-
type: TypeNotificationType;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const defaultIcons: {
|
|
31
|
-
[key: string]: TypeIconName;
|
|
32
|
-
} = {
|
|
33
|
-
alert: 'ErrorGeneral',
|
|
34
|
-
success: 'Tick',
|
|
35
|
-
warning: 'Warning',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Notification component used to inform the user of something important.
|
|
40
|
-
*/
|
|
41
|
-
const Notification: React.FunctionComponent<Props> = (props: Props) => {
|
|
42
|
-
const { children, onRemove, type, icon, className, ...rest } = props;
|
|
43
|
-
|
|
44
|
-
const classes = classnames('Notification', `Notification--type-${type}`, className);
|
|
45
|
-
const defaultIcon = defaultIcons[type];
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Flex {...rest} alignChildrenVertical="middle" className={classes} direction="horizontal" gap="x2" padding="x3">
|
|
49
|
-
{(icon || defaultIcon || type === 'progress') && (
|
|
50
|
-
<Flex>{type === 'progress' ? <ProgressSpinner /> : <Icon name={icon || defaultIcon} />}</Flex>
|
|
51
|
-
)}
|
|
52
|
-
|
|
53
|
-
<Flex grow shrink>
|
|
54
|
-
{children}
|
|
55
|
-
</Flex>
|
|
56
|
-
|
|
57
|
-
{onRemove && (
|
|
58
|
-
<Flex>
|
|
59
|
-
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
60
|
-
<Link as="button" onClick={onRemove}>
|
|
61
|
-
<Icon name="CloseSmall" />
|
|
62
|
-
</Link>
|
|
63
|
-
</Flex>
|
|
64
|
-
)}
|
|
65
|
-
</Flex>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default Notification;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Notification default icon can be overridden 1`] = `
|
|
4
|
-
<Flex
|
|
5
|
-
alignChildrenVertical="middle"
|
|
6
|
-
className="Notification Notification--type-alert"
|
|
7
|
-
direction="horizontal"
|
|
8
|
-
gap="x2"
|
|
9
|
-
padding="x3"
|
|
10
|
-
>
|
|
11
|
-
<Flex>
|
|
12
|
-
<ForwardRef
|
|
13
|
-
name="Bell"
|
|
14
|
-
/>
|
|
15
|
-
</Flex>
|
|
16
|
-
<Flex
|
|
17
|
-
grow={true}
|
|
18
|
-
shrink={true}
|
|
19
|
-
>
|
|
20
|
-
Content
|
|
21
|
-
</Flex>
|
|
22
|
-
</Flex>
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
exports[`Notification default template 1`] = `
|
|
26
|
-
<Flex
|
|
27
|
-
alignChildrenVertical="middle"
|
|
28
|
-
className="Notification Notification--type-alert"
|
|
29
|
-
direction="horizontal"
|
|
30
|
-
gap="x2"
|
|
31
|
-
padding="x3"
|
|
32
|
-
>
|
|
33
|
-
<Flex>
|
|
34
|
-
<ForwardRef
|
|
35
|
-
name="ErrorGeneral"
|
|
36
|
-
/>
|
|
37
|
-
</Flex>
|
|
38
|
-
<Flex
|
|
39
|
-
grow={true}
|
|
40
|
-
shrink={true}
|
|
41
|
-
>
|
|
42
|
-
Content
|
|
43
|
-
</Flex>
|
|
44
|
-
</Flex>
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
exports[`Notification with onRemove has a close icon 1`] = `
|
|
48
|
-
<Flex
|
|
49
|
-
alignChildrenVertical="middle"
|
|
50
|
-
className="Notification Notification--type-alert"
|
|
51
|
-
direction="horizontal"
|
|
52
|
-
gap="x2"
|
|
53
|
-
padding="x3"
|
|
54
|
-
>
|
|
55
|
-
<Flex>
|
|
56
|
-
<ForwardRef
|
|
57
|
-
name="ErrorGeneral"
|
|
58
|
-
/>
|
|
59
|
-
</Flex>
|
|
60
|
-
<Flex
|
|
61
|
-
grow={true}
|
|
62
|
-
shrink={true}
|
|
63
|
-
>
|
|
64
|
-
Content
|
|
65
|
-
</Flex>
|
|
66
|
-
<Flex>
|
|
67
|
-
<ForwardRef
|
|
68
|
-
as="button"
|
|
69
|
-
isUnderlined={false}
|
|
70
|
-
onClick={[Function]}
|
|
71
|
-
>
|
|
72
|
-
<ForwardRef
|
|
73
|
-
name="CloseSmall"
|
|
74
|
-
/>
|
|
75
|
-
</ForwardRef>
|
|
76
|
-
</Flex>
|
|
77
|
-
</Flex>
|
|
78
|
-
`;
|