Skip to content

Commit

Permalink
feat: add file list
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Nov 11, 2024
1 parent 2f3754f commit b01390b
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 1 deletion.
9 changes: 9 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@
"react": false,
"dependencies": []
},
"file-list": {
"test": false,
"version": "0.1.0",
"style": true,
"icon": false,
"install": false,
"react": false,
"dependencies": []
},
"gallery": {
"icon": true,
"dependencies": ["carousel", "image-viewer", "toolbar"],
Expand Down
27 changes: 27 additions & 0 deletions src/file-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Luna File List

List files in the directory.

## Demo

https://luna.liriliri.io/?path=/story/file-list

## Install

Add the following script and style to your page.

```html
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-file-list/luna-file-list.css" />
<script src="//cdn.jsdelivr.net/npm/luna-file-list/luna-file-list.js"></script>
```

You can also get it on npm.

```bash
npm install luna-file-list --save
```

```javascript
import 'luna-file-list/luna-file-list.css'
import LunaFileList from 'luna-file-list'
```
15 changes: 15 additions & 0 deletions src/file-list/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Component from '../share/Component'
import { exportCjs } from '../share/util'

/**
* List files in the directory.
*/
export default class FileList extends Component {
constructor(container: HTMLElement) {
super(container, { compName: 'file-list' })
}
}

if (typeof module !== 'undefined') {
exportCjs(module, FileList)
}
8 changes: 8 additions & 0 deletions src/file-list/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "file-list",
"version": "0.1.0",
"description": "List files in the directory",
"luna": {
"test": false
}
}
20 changes: 20 additions & 0 deletions src/file-list/story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'luna-file-list.css'
import FileList from 'luna-file-list.js'
import readme from './README.md'
import story from '../share/story'

const def = story(
'file-list',
(container) => {
const fileList = new FileList(container)

return fileList
},
{
readme,
story: __STORY__,
}
)

export default def
export const { fileList } = def
Empty file added src/file-list/style.scss
Empty file.
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"luna-mask-editor": ["src/mask-editor/index"],
"luna-image-list": ["src/image-list/index"],
"luna-lrc-player": ["src/lrc-player/index"],
"luna-logcat": ["src/logcat/index"]
"luna-logcat": ["src/logcat/index"],
"luna-file-list": ["src/file-list/index"]
}
}
}

0 comments on commit b01390b

Please sign in to comment.