Skip to content

Commit 87c8c12

Browse files
committed
chore(react-toggle-list): add README.md
1 parent 30b299d commit 87c8c12

File tree

1 file changed

+13
-156
lines changed

1 file changed

+13
-156
lines changed

packages/react-toggle-list/README.md

Lines changed: 13 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,48 @@
1-
# react-toggle-file-tree
2-
3-
The `react-toggle-file-tree` is designed to display a file/folder structure based on the provided list of files and their properties.
4-
This component organizes the files into folders and subfolders based on their localPath. Each folder can contain multiple files with their respective fileName
1+
# react-toggle-list
52

3+
The `react-toggle-list` is can hide and show content inside.
64

75
## Document
6+
87
---
98

109
- [Installation](#installation)
1110
- [How to use](#how-to-use)
12-
- [Demos](#demos)
13-
- [Supported file types](#supported-file-types)
1411
- [Contribute](#contribute)
1512

13+
## Installation
1614

17-
## Installation
1815
---
1916

20-
This library use `react-toggle-file-tree`, so you need to install it.
17+
This library use `react-toggle-list`, so you need to install it.
2118

2219
```bash
23-
npm install --save react-toggle-file-tree
20+
npm install --save react-toggle-list
2421
```
2522

2623
or
2724

2825
```bash
29-
yarn add react-toggle-file-tree
26+
yarn add react-toggle-list
3027
```
3128

32-
3329
## How to use
34-
---
35-
```tsx
36-
import {
37-
createFileTree,
38-
Directory,
39-
ToggleFileTree,
40-
} from 'react-toggle-file-tree';
41-
42-
<ToggleFileTree
43-
list={createFileTree(list) as Directory}
44-
handleFileClick={handleFileClick}
45-
handleDirectoryClick={handleDirectoryClick}
46-
/>
47-
```
48-
49-
⚠ The list must contain the localPath and fileName keys.
50-
51-
<details>
52-
<summary>list example view</summary>
53-
54-
```ts
55-
const list = [
56-
{
57-
localPath: '/',
58-
fileName: 'inch.txt',
59-
properties: {
60-
size: '1 bit',
61-
anything: 'possible',
62-
a: 'b',
63-
},
64-
},
65-
{
66-
localPath: '/fruit',
67-
fileName: 'apple.docs',
68-
properties: {
69-
sizezz: '12mb',
70-
azvv: 'asdfasd',
71-
},
72-
},
73-
{
74-
localPath: '/fruit',
75-
fileName: 'banana.png',
76-
properties: {
77-
sizezz: '12mb',
78-
azvv: 'asdfasd',
79-
},
80-
},
81-
{
82-
localPath: '/vehicle/car',
83-
fileName: 'truck.pdf',
84-
properties: {
85-
sizezz: '12mb',
86-
azvv: 'asdfasd',
87-
},
88-
},
89-
{
90-
localPath: '/vehicle/car',
91-
fileName: 'taxi.ppt',
92-
properties: {
93-
sizezz: '12mb',
94-
azvv: 'asdfasd',
95-
},
96-
},
97-
{
98-
localPath: '/plant/tree',
99-
fileName: 'oak.json',
100-
properties: {
101-
sizezz: '10mb',
102-
azvv: 'asdfasd',
103-
},
104-
},
105-
{
106-
localPath: '/plant/tree',
107-
fileName: 'maple.zip',
108-
properties: {
109-
sizezz: '8mb',
110-
azvv: 'asdfasd',
111-
},
112-
},
113-
{
114-
localPath: '/plant/flower',
115-
fileName: 'cherry-blossom.numbers',
116-
properties: {
117-
sizezz: '5mb',
118-
azvv: 'asdfasd',
119-
},
120-
},
121-
{
122-
localPath: '/plant/fruit',
123-
fileName: 'apple-tree.csv',
124-
properties: {
125-
sizezz: '15mb',
126-
azvv: 'asdfasd',
127-
},
128-
},
129-
];
130-
```
131-
</details>
132-
133-
134-
## Demos
135-
---
136-
![gif](https://github.com/in-ch/react-file-folder/assets/49556566/a96f28a3-7532-4d40-9ce8-29307b52c007)
137-
138-
139-
## Supported file types
140-
---
141-
The `react-toggle-file-tree` supports the following file formats:
142-
143-
Documents: csv, docs, html, json, manifest, numbers, pdf, ppt, pptx, txt, xlsx
144-
145-
Images: gif, jpg, jpeg, png
146-
147-
Media: mov, mp4
148-
149-
Scripts: js, ts
150-
151-
Compressed: gif, zip
152-
15330

154-
## Example code
15531
---
15632

157-
You can see the example code and demo.
158-
159-
Clone the repository
160-
161-
```bash
162-
git clone https://github.com/in-ch/react-file-folder.git
163-
```
164-
165-
Install libraries
166-
167-
```bash
168-
cd example
169-
```
170-
171-
and
172-
173-
```bash
174-
npm install
175-
```
176-
177-
or
33+
```tsx
34+
import { ReactToggleList } from 'react-toggle-list';
17835

36+
const subItems = ['string1', 'string2', 'string3'];
17937

180-
```bash
181-
yarn
38+
<ReactToggleList title="example" subItems={subItems} />;
18239
```
18340

184-
18541
## Contribute
42+
18643
---
18744

188-
You can follow below to contribute `react-toggle-file-tree`
45+
You can follow below to contribute `react-toggle-list`
18946

19047
Clone the repository.
19148

0 commit comments

Comments
 (0)