Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 5bcc8a8

Browse files
committed
feat: add file view
1 parent 6619fbe commit 5bcc8a8

File tree

17 files changed

+473
-4
lines changed

17 files changed

+473
-4
lines changed

app/assets/views/file.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<lcui-app>
3+
<ui>
4+
<w class="container">
5+
<h1 ref="header" class="v-file__header">Directory listing for /</h1>
6+
<w ref="body" class="v-file__body" />
7+
</w>
8+
</ui>
9+
</lcui-app>

app/assets/views/home.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<icon class="v-home__card-icon text-pink" name="emoticon-cool-outline" />
77
<text class="v-home__card-title">Welcome!</text>
88
</router-link>
9+
<router-link class="v-home__card" to="/file">
10+
<icon class="v-home__card-icon text-orange" name="folder-search" />
11+
<text class="v-home__card-title">File</text>
12+
</router-link>
913
<router-link class="v-home__card" to="/help">
1014
<icon class="v-home__card-icon text-blue" name="help-box" />
1115
<text class="v-home__card-title">About</text>

app/assets/views/notfound.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<lcui-app>
3+
<ui>
4+
<notfound>
5+
<textview>notfound</textview>
6+
</notfound>
7+
</ui>
8+
</lcui-app>

app/assets/views/welcome.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,43 @@
1010
<w class="row">
1111
<w class="col col-6">
1212
<w class="buttons-wrapper mb-4">
13-
<p>LCUI is a freely available software library for building user interfaces. It is written in C and supports the use of XML and CSS to describe the graphical interface of simple desktop apps.</p>
13+
<h3>LCUI</h3>
14+
<p>A freely available software library for building user interfaces. It is written in C and supports the use of XML and CSS to describe the graphical interface of simple desktop apps.</p>
1415
<a class="btn btn-outline-primary" href="https://github.com/lc-soft/LCUI">
1516
See more
1617
</a>
1718
</w>
1819
</w>
1920
<w class="col col-6">
2021
<w class="buttons-wrapper">
21-
<p>LCUI Router is the official router for LCUI. It provides a similar development experience to the Vue Router and make building multiple views applications with LCUI a breeze.</p>
22+
<h3>LCUI Router</h3>
23+
<p>The official router for LCUI. It provides a similar development experience to the Vue Router and make building multiple views applications with LCUI a breeze.</p>
2224
<a class="btn btn-outline-primary" href="https://github.com/lc-soft/lcui-router">
2325
See more
2426
</a>
2527
</w>
2628
</w>
2729
</w>
30+
<w class="row">
31+
<w class="col col-6">
32+
<w class="buttons-wrapper mb-4">
33+
<h3>LC Design</h3>
34+
<p>A UI component framework for building LCUI application, it provides basic styles for typography and elements, simple layout system, CSS components and utilities. Its CSS code is based Bootstrap, so its usage is basically the same as Boostrap.</p>
35+
<a class="btn btn-outline-primary" href="https://github.com/lc-ui/lc-design">
36+
See more
37+
</a>
38+
</w>
39+
</w>
40+
<w class="col col-6">
41+
<w class="buttons-wrapper">
42+
<h3>LCUI CLI</h3>
43+
<p>Command line interface for rapid LCUI development. It providing: mininal LCUI project template, generator for components and views, internationalization (i18n), router config file compilation.</p>
44+
<a class="btn btn-outline-primary" href="https://github.com/lc-ui/lcui-cli">
45+
See more
46+
</a>
47+
</w>
48+
</w>
49+
</w>
2850
</w>
2951
</ui>
3052
</lcui-app>

config/router.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ module.exports = [
1414
path: '/help',
1515
component: 'help'
1616
},
17+
{
18+
path: '/file',
19+
component: 'file'
20+
},
21+
{
22+
name: 'file',
23+
path: '/file/*',
24+
component: 'file'
25+
},
1726
{
1827
path: '*',
1928
component: 'notfound'

src/lib/router.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ static void router_add_default_config(router_t *router)
2626
router_add_route_record(router, config, NULL);
2727
router_config_destroy(config);
2828

29+
config = router_config_create();
30+
router_config_set_path(config, "/file");
31+
router_config_set_component(config, NULL, "file");
32+
router_add_route_record(router, config, NULL);
33+
router_config_destroy(config);
34+
35+
config = router_config_create();
36+
router_config_set_name(config, "file");
37+
router_config_set_path(config, "/file/*");
38+
router_config_set_component(config, NULL, "file");
39+
router_add_route_record(router, config, NULL);
40+
router_config_destroy(config);
41+
2942
config = router_config_create();
3043
router_config_set_path(config, "*");
3144
router_config_set_component(config, NULL, "notfound");

src/ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int UI_Init(void)
1010
{
1111
LCUI_Widget root;
1212
LCUI_Widget wrapper;
13-
LCUI_Widget browser;
13+
LCUI_Widget browser;
1414

1515
LCUI_Init();
1616
LCDesign_Init();

src/ui/stylesheets/_views.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
@import "views/welcome";
44
@import "views/home";
55
@import "views/help";
6+
@import "views/file";
7+
@import "views/notfound";

src/ui/stylesheets/app.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
color: $blue;
1111
}
1212

13+
.text-orange {
14+
color: $orange;
15+
}
16+
1317
textview, a {
1418
color: $primary-text-color;
1519
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.v-file {
2+
3+
}
4+
5+
.v-file__body {
6+
margin: 0 -5px 0 -5px;
7+
}
8+
9+
.c-file-list-item__left {
10+
display: flex;
11+
flex: 1 1 auto;
12+
}
13+
14+
.c-file-list-item__name {
15+
flex: 1 1 auto;
16+
}
17+
18+
.c-file-list-item__link {
19+
display: inline-block;
20+
}
21+
22+
router-link.c-file-list-item__link {
23+
color: $primary;
24+
25+
&:hover {
26+
color: lighten($primary, 10);
27+
}
28+
&:active {
29+
color: darken($primary, 10);
30+
}
31+
}
32+
33+
.c-file-list-item__icon {
34+
margin-right: 5px;
35+
flex: 0 0 auto;
36+
}
37+
38+
.c-file-list-item__size {
39+
flex: 0 0 auto;
40+
width: 100px;
41+
}
42+
43+
.c-file-list-item__date {
44+
flex: 0 0 auto;
45+
text-align: right;
46+
width: 180px;
47+
}
48+
49+
.c-file-list-item {
50+
display: flex;
51+
padding: 5px;
52+
53+
&:hover {
54+
background-color: rgba($primary, 0.05);
55+
}
56+
57+
&.is-folder {
58+
.c-file-list-item__icon {
59+
color: $orange;
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)