|
| 1 | +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | +import React from 'react'; |
| 4 | + |
| 5 | +import Button from '~components/button'; |
| 6 | +import Link from '~components/link'; |
| 7 | +import Popover from '~components/popover'; |
| 8 | +import { TreeViewProps } from '~components/tree-view'; |
| 9 | + |
| 10 | +import { Actions } from '../common'; |
| 11 | + |
| 12 | +export interface Item extends TreeViewProps.TreeItem { |
| 13 | + id: string; |
| 14 | + children?: Item[]; |
| 15 | + hasToggleButton?: boolean; |
| 16 | +} |
| 17 | + |
| 18 | +export const stsnRegisteredItems: Item[] = [ |
| 19 | + { |
| 20 | + id: 'cds1', |
| 21 | + content: ( |
| 22 | + <> |
| 23 | + Item 1{' '} |
| 24 | + <Popover size="small" content="popover content" dismissButton={false}> |
| 25 | + popover |
| 26 | + </Popover> |
| 27 | + </> |
| 28 | + ), |
| 29 | + actions: <Actions actionType="button-dropdown" itemLabel="Item 1" />, |
| 30 | + announcementLabel: 'Item 1 popover', |
| 31 | + }, |
| 32 | + { |
| 33 | + id: 'cds2', |
| 34 | + content: ( |
| 35 | + <> |
| 36 | + Item 2{' '} |
| 37 | + <Popover |
| 38 | + size="medium" |
| 39 | + content={ |
| 40 | + <> |
| 41 | + Popover content and a <Button>button</Button> |
| 42 | + </> |
| 43 | + } |
| 44 | + header="Header" |
| 45 | + > |
| 46 | + popover with dismiss button |
| 47 | + </Popover> |
| 48 | + </> |
| 49 | + ), |
| 50 | + actions: <Actions actionType="button-group" itemLabel="Item 2" />, |
| 51 | + announcementLabel: 'Item 2 popover with dismiss button', |
| 52 | + children: [ |
| 53 | + { |
| 54 | + id: 'cds2.1', |
| 55 | + content: 'Item 2.1', |
| 56 | + actions: <Actions actionType="button-group" itemLabel="Item 2.1" />, |
| 57 | + }, |
| 58 | + { |
| 59 | + id: 'cds2.2', |
| 60 | + content: 'Item 2.2', |
| 61 | + actions: <Actions actionType="button-group" itemLabel="Item 2.2" />, |
| 62 | + }, |
| 63 | + ], |
| 64 | + }, |
| 65 | + { |
| 66 | + id: 'cds3', |
| 67 | + content: 'Item 3', |
| 68 | + hasToggleButton: true, |
| 69 | + actions: <Actions actionType="inline-button-dropdown" itemLabel="Item 3" />, |
| 70 | + announcementLabel: 'Item 3', |
| 71 | + children: [ |
| 72 | + { |
| 73 | + id: 'cds3.1', |
| 74 | + content: 'Item 3.1', |
| 75 | + actions: <Actions actionType="inline-button-dropdown" itemLabel="Item 3.1" disabled={true} />, |
| 76 | + announcementLabel: 'Item 3.1', |
| 77 | + hasToggleButton: true, |
| 78 | + }, |
| 79 | + { |
| 80 | + id: 'cds3.2', |
| 81 | + content: 'Item 3.2', |
| 82 | + actions: <Actions actionType="inline-button-dropdown" itemLabel="Item 3.2" />, |
| 83 | + announcementLabel: 'Item 3.2', |
| 84 | + hasToggleButton: true, |
| 85 | + children: [ |
| 86 | + { |
| 87 | + id: 'cds3.2.1', |
| 88 | + content: 'Item 3.2.1', |
| 89 | + actions: <Actions actionType="button-group" itemLabel="Item 3.2.1" />, |
| 90 | + }, |
| 91 | + { |
| 92 | + id: 'cds3.2.2', |
| 93 | + content: 'Item 3.2.2', |
| 94 | + actions: <Actions actionType="button-group" itemLabel="Item 3.2.2" />, |
| 95 | + }, |
| 96 | + { |
| 97 | + id: 'cds3.2.3', |
| 98 | + content: 'Item 3.2.3', |
| 99 | + actions: <Actions actionType="button-group" itemLabel="Item 3.2.3" />, |
| 100 | + }, |
| 101 | + ], |
| 102 | + }, |
| 103 | + ], |
| 104 | + }, |
| 105 | + { |
| 106 | + id: 'cds4', |
| 107 | + content: 'Item 4', |
| 108 | + actions: <Actions disabled={true} actionType="inline-button-dropdown" itemLabel="Item 4" />, |
| 109 | + secondaryContent: ( |
| 110 | + <> |
| 111 | + Description with{' '} |
| 112 | + <Link href="#" variant="primary"> |
| 113 | + link |
| 114 | + </Link> |
| 115 | + </> |
| 116 | + ), |
| 117 | + children: [ |
| 118 | + { |
| 119 | + id: 'cds4.1', |
| 120 | + content: 'Item 4.1', |
| 121 | + }, |
| 122 | + ], |
| 123 | + }, |
| 124 | + { |
| 125 | + id: 'cds5', |
| 126 | + content: 'Item 5', |
| 127 | + actions: <Actions actionType="button-group" itemLabel="Item 5" />, |
| 128 | + children: [ |
| 129 | + { |
| 130 | + id: 'cds5.1', |
| 131 | + content: 'Item 5.1', |
| 132 | + }, |
| 133 | + ], |
| 134 | + }, |
| 135 | + { |
| 136 | + id: 'cds6', |
| 137 | + content: ( |
| 138 | + <> |
| 139 | + Item 6{' '} |
| 140 | + <Popover |
| 141 | + size="medium" |
| 142 | + content={ |
| 143 | + <> |
| 144 | + Popover content and a <Button>button</Button> |
| 145 | + </> |
| 146 | + } |
| 147 | + header="Header" |
| 148 | + > |
| 149 | + popover with dismiss button |
| 150 | + </Popover> |
| 151 | + </> |
| 152 | + ), |
| 153 | + secondaryContent: ( |
| 154 | + <> |
| 155 | + Description with{' '} |
| 156 | + <Link href="#" variant="primary"> |
| 157 | + link |
| 158 | + </Link> |
| 159 | + </> |
| 160 | + ), |
| 161 | + actions: <Actions actionType="button-group" itemLabel="Item 6" />, |
| 162 | + announcementLabel: 'Item 6 popover with dismiss button', |
| 163 | + }, |
| 164 | +]; |
| 165 | + |
| 166 | +export const nonStsnRegisteredItems: Item[] = [ |
| 167 | + { |
| 168 | + id: 'non-cds1', |
| 169 | + content: 'Item 1', |
| 170 | + actions: <button>Action</button>, |
| 171 | + children: [ |
| 172 | + { |
| 173 | + id: 'non-cds1.1', |
| 174 | + content: 'Item 1.1', |
| 175 | + actions: <button>Action</button>, |
| 176 | + }, |
| 177 | + { |
| 178 | + id: 'non-cds1.2', |
| 179 | + content: 'Item 1.2', |
| 180 | + actions: <button>Action</button>, |
| 181 | + }, |
| 182 | + ], |
| 183 | + }, |
| 184 | + { |
| 185 | + id: 'non-cds2', |
| 186 | + content: ( |
| 187 | + <> |
| 188 | + Item 2 with <a href="#">link</a> |
| 189 | + </> |
| 190 | + ), |
| 191 | + actions: <button>Action</button>, |
| 192 | + announcementLabel: 'Item 2 with link', |
| 193 | + children: [ |
| 194 | + { |
| 195 | + id: 'non-cds2.1', |
| 196 | + content: ( |
| 197 | + <> |
| 198 | + Item 2.1 with <a href="#">link</a> |
| 199 | + </> |
| 200 | + ), |
| 201 | + announcementLabel: 'Item 2.1 with link', |
| 202 | + }, |
| 203 | + ], |
| 204 | + }, |
| 205 | + { |
| 206 | + id: 'non-cds3', |
| 207 | + content: 'Item 3', |
| 208 | + actions: ( |
| 209 | + <div style={{ display: 'flex', flexDirection: 'row', gap: '5px' }}> |
| 210 | + <button>Action 1</button> |
| 211 | + <button>Action 2</button> |
| 212 | + </div> |
| 213 | + ), |
| 214 | + }, |
| 215 | +]; |
0 commit comments