Skip to content

Commit 51e46a3

Browse files
authored
Merge pull request #12 from FlowingCode/styles
Add default styles. Fixes #5
2 parents 82e7063 + 14a71ce commit 51e46a3

File tree

5 files changed

+67
-37
lines changed

5 files changed

+67
-37
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
<webAppConfig>
170170
<resourceBases>
171171
<resourceBase>src/test/resources/META-INF/resources</resourceBase>
172+
<resourceBase>src/main/resources/META-INF/resources</resourceBase>
172173
<!-- This is only needed to be able to unzip webjars
173174
directly into src/test/webjar-debug and modify them for testing -->
174175
<resourceBase>src/test/webjar-debug/META-INF/resources</resourceBase>

src/main/java/com/flowingcode/addons/applayout/AppLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@HtmlImport("bower_components/iron-icons/iron-icons.html")
4444
@HtmlImport("bower_components/app-layout/app-scroll-effects/app-scroll-effects.html")
4545
@HtmlImport("bower_components/app-layout/app-toolbar/app-toolbar.html")
46-
@HtmlImport("styles/shared-styles.html")
46+
@HtmlImport("frontend://styles/applayout-styles.html")
4747
public class AppLayout extends Div implements PageConfigurator {
4848

4949
AppDrawer drawer;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!--
2+
#%L
3+
App Layout Addon
4+
%%
5+
Copyright (C) 2018 Flowing Code
6+
%%
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
#L%
19+
-->
20+
<custom-style>
21+
<!-- This is where your App's styling should go. You can use .css files too. -->
22+
<style>
23+
.sub-menu{
24+
background-color: var(--lumo-primary-color-10pct);
25+
}
26+
27+
app-toolbar {
28+
background-color: #4285f4;
29+
color: #fff;
30+
}
31+
32+
paper-icon-button {
33+
--paper-icon-button-ink-color: white;
34+
}
35+
36+
paper-icon-button + [main-title] {
37+
margin-left: 24px;
38+
}
39+
40+
paper-progress {
41+
display: block;
42+
width: 100%;
43+
--paper-progress-active-color: rgba(255, 255, 255, 0.5);
44+
--paper-progress-container-color: transparent;
45+
}
46+
47+
app-header {
48+
position: var(--layout-fixed-top_-_position); top: var(--layout-fixed-top_-_top); left: var(--layout-fixed-top_-_left); right: var(--layout-fixed-top_-_right);
49+
color: #fff;
50+
--app-header-background-rear-layer_-_background-color: #ef6c00;;
51+
}
52+
53+
app-drawer {
54+
--app-drawer-scrim-background: rgba(0, 0, 100, 0.8);
55+
--app-drawer-content-container_-_background-color: #B0BEC5;
56+
z-index: 1000;
57+
}
58+
59+
</style>
60+
</custom-style>

src/test/java/com/flowingcode/addons/applayout/DemoView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
import com.vaadin.flow.component.html.Image;
2929
import com.vaadin.flow.component.notification.Notification;
3030
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
31+
import com.vaadin.flow.component.dependency.HtmlImport;
3132
import com.vaadin.flow.router.Route;
3233

3334
@SuppressWarnings("serial")
3435
@Route("")
36+
@HtmlImport("frontend://styles/shared-styles.html")
3537
public class DemoView extends VerticalLayout {
3638

3739
private VerticalLayout container = new VerticalLayout();

src/test/resources/META-INF/resources/frontend/styles/shared-styles.html

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,12 @@
2828
max-height: 368px;
2929
}
3030

31-
.sub-menu{
32-
background-color: var(--lumo-primary-color-10pct);
33-
}
34-
35-
app-toolbar {
36-
background-color: #4285f4;
37-
color: #fff;
38-
}
39-
40-
paper-icon-button {
41-
--paper-icon-button-ink-color: white;
42-
}
43-
44-
paper-icon-button + [main-title] {
45-
margin-left: 24px;
46-
}
47-
48-
paper-progress {
49-
display: block;
50-
width: 100%;
51-
--paper-progress-active-color: rgba(255, 255, 255, 0.5);
52-
--paper-progress-container-color: transparent;
53-
}
54-
55-
app-header {
56-
position: var(--layout-fixed-top_-_position); top: var(--layout-fixed-top_-_top); left: var(--layout-fixed-top_-_left); right: var(--layout-fixed-top_-_right);
57-
color: #fff;
58-
--app-header-background-rear-layer_-_background-color: #ef6c00;;
31+
sample-content {
32+
padding-top: 64px;
5933
}
6034

6135
app-drawer {
62-
--app-drawer-scrim-background: rgba(0, 0, 100, 0.8);
63-
--app-drawer-content-container_-_background-color: #B0BEC5;
64-
z-index: 1000;
65-
}
66-
67-
sample-content {
68-
padding-top: 64px;
36+
z-index: 1001;
6937
}
70-
7138
</style>
7239
</custom-style>

0 commit comments

Comments
 (0)