Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Update test file
Browse files Browse the repository at this point in the history
  • Loading branch information
sycombs committed Nov 14, 2023
1 parent 4119c24 commit 0a90f5f
Showing 1 changed file with 81 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,86 @@
import React from 'react';

import { IconDocuments } from 'terra-icon';
import FolderTree from 'terra-folder-tree';

const BasicFolderTree = () => (
<FolderTree
title="Header Title"
/>
);
const BasicFolderTree = () => {
const [selectedKey, setSelectedKey] = React.useState('a');

return (
<FolderTree
title="Documents"
key="a"
isSelected={selectedKey === 'a'}
onClick={() => { setSelectedKey('a'); }}
>
<FolderTree.Item
label="info.txt"
icon={<IconDocuments />}
key="b"
isSelected={selectedKey === 'b'}
onClick={() => { setSelectedKey('b'); }}
/>
<FolderTree.Item
label="projects_2023.txt"
icon={<IconDocuments />}
key="c"
isSelected={selectedKey === 'c'}
onClick={() => { setSelectedKey('c'); }}
/>
<FolderTree.Item
label="Projects"
key="d"
isSelected={selectedKey === 'd'}
onClick={() => { setSelectedKey('d'); }}
subfolderItems={[
(<FolderTree.Item
label="project_data1.txt"
icon={<IconDocuments />}
key="e"
isSelected={selectedKey === 'e'}
onClick={() => { setSelectedKey('e'); }}
/>),
(<FolderTree.Item
label="project_data2.txt"
icon={<IconDocuments />}
key="f"
isSelected={selectedKey === 'f'}
onClick={() => { setSelectedKey('f'); }}
/>),
(<FolderTree.Item
label="Tests"
key="g"
isSelected={selectedKey === 'g'}
onClick={() => { setSelectedKey('g'); }}
icon={<IconDocuments />}
subfolderItems={[
(<FolderTree.Item
label="very_very_very_very_very_very_very_long_name_test.txt"
icon={<IconDocuments />}
key="h"
isSelected={selectedKey === 'h'}
onClick={() => { setSelectedKey('h'); }}
/>),
(<FolderTree.Item
label="test.txt"
icon={<IconDocuments />}
key="i"
isSelected={selectedKey === 'i'}
onClick={() => { setSelectedKey('i'); }}
/>),
(<FolderTree.Item
label="even_longer_long_long_long_long_long_long_long_long_long_long_long_long_name_test.txt"
icon={<IconDocuments />}
key="j"
isSelected={selectedKey === 'j'}
onClick={() => { setSelectedKey('j'); }}
/>),
]}
/>),
]}
/>
</FolderTree>
);
};

export default BasicFolderTree;

0 comments on commit 0a90f5f

Please sign in to comment.