Skip to content

Commit 5f8fc91

Browse files
feat(components): Add notAvailable component (#23089)
1 parent 14ea59d commit 5f8fc91

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import {withInfo} from '@storybook/addon-info';
3+
4+
import NotAvailable from 'app/components/notAvailable';
5+
import PanelTable from 'app/components/panels/panelTable';
6+
7+
export default {
8+
title: 'Core/NotAvailable',
9+
};
10+
11+
export const Default = withInfo(
12+
"When you don't have data to display, but don't want to display an empty space. It's commonly used in a table."
13+
)(() => (
14+
<div>
15+
<div className="section">
16+
<h3>Alone</h3>
17+
<NotAvailable />
18+
</div>
19+
<div className="section">
20+
<h3>In a Table</h3>
21+
<PanelTable headers={['Header #1', 'Header #2']}>
22+
<div>Panel Item with really long content</div>
23+
<div>
24+
<NotAvailable />
25+
</div>
26+
</PanelTable>
27+
</div>
28+
</div>
29+
));
30+
31+
Default.story = {
32+
name: 'default',
33+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import styled from '@emotion/styled';
3+
4+
function NotAvailable() {
5+
return <Wrapper>{'\u2014'}</Wrapper>;
6+
}
7+
8+
const Wrapper = styled('div')`
9+
color: ${p => p.theme.gray200};
10+
`;
11+
12+
export default NotAvailable;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
3+
import {mountWithTheme} from 'sentry-test/enzyme';
4+
5+
import NotAvailable from 'app/components/notAvailable';
6+
7+
describe('NotAvailable', function () {
8+
it('renders', function () {
9+
const wrapper = mountWithTheme(<NotAvailable />);
10+
expect(wrapper.text()).toEqual('\u2014');
11+
});
12+
});

0 commit comments

Comments
 (0)