forked from adobe/react-spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
82 lines (77 loc) · 2.88 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import './App.css';
import {Provider, defaultTheme, Item, TagGroup, Cell, Column, Row, TableBody, TableHeader, TableView} from '@adobe/react-spectrum';
import Lighting from './Lighting';
import {useState} from 'react'
import BodyContent from './BodyContent';
import {enableTableNestedRows} from '@react-stately-nutrient/flags';
import ButtonExamples from './sections/ButtonExamples';
import CollectionExamples from './sections/CollectionExamples';
import DateTimeExamples from './sections/DateTimeExamples';
import FormExamples from './sections/FormExamples';
import NavigationExamples from './sections/NavigationExamples';
import OverlayExamples from './sections/OverlayExamples';
import ColorExamples from './sections/ColorExamples';
import StatusExamples from './sections/StatusExamples';
import ContentExamples from './sections/ContentExamples';
import PickerExamples from './sections/PickerExamples';
import DragAndDropExamples from './sections/DragAndDropExamples';
import {AutocompleteExample} from './AutocompleteExample';
let columns = [
{name: 'Foo', key: 'foo'},
{name: 'Bar', key: 'bar'},
{name: 'Baz', key: 'baz'}
];
let nestedItems = [
{foo: 'Lvl 1 Foo 1', bar: 'Lvl 1 Bar 1', baz: 'Lvl 1 Baz 1', childRows: [
{foo: 'Lvl 2 Foo 1', bar: 'Lvl 2 Bar 1', baz: 'Lvl 2 Baz 1', childRows: [
{foo: 'Lvl 3 Foo 1', bar: 'Lvl 3 Bar 1', baz: 'Lvl 3 Baz 1'}
]},
{foo: 'Lvl 2 Foo 2', bar: 'Lvl 2 Bar 2', baz: 'Lvl 2 Baz 2'}
]}
];
function App() {
let [selected, setSelection] = useState(false);
enableTableNestedRows();
return (
<Provider theme={defaultTheme}
colorScheme={selected ? "light" : "dark"}>
<div className="content-padding">
<Lighting selected={selected} switch={setSelection}/>
<TagGroup aria-label="Static TagGroup items example">
<Item>News</Item>
<Item>Travel</Item>
<Item>Gaming</Item>
<Item>Shopping</Item>
</TagGroup>
<BodyContent />
<TableView aria-label="example table with nested rows" UNSTABLE_allowsExpandableRows width={500} height={200} >
<TableHeader columns={columns}>
{column => <Column>{column.name}</Column>}
</TableHeader>
<TableBody items={nestedItems}>
{(item: any) =>
(<Row key={item.foo} UNSTABLE_childItems={item.childRows}>
{(key) => {
return <Cell>{item[key]}</Cell>;
}}
</Row>)
}
</TableBody>
</TableView>
<AutocompleteExample />
<ButtonExamples />
<CollectionExamples />
<ColorExamples />
<DateTimeExamples />
<FormExamples />
<NavigationExamples />
<OverlayExamples />
<StatusExamples />
<ContentExamples />
<PickerExamples />
<DragAndDropExamples />
</div>
</Provider>
);
}
export default App;