Skip to content

Commit c61e48c

Browse files
author
Jouni Koivuviita
committed
Updated report view styles
The palette is now more clear looking and items in the canvas are now animated into view.
1 parent 4b3d112 commit c61e48c

File tree

3 files changed

+53
-20
lines changed

3 files changed

+53
-20
lines changed

src/main/java/com/vaadin/demo/dashboard/component/InlineTextEditor.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import com.vaadin.data.Property;
44
import com.vaadin.data.util.ObjectProperty;
5-
import com.vaadin.demo.dashboard.data.dummy.DummyDataGenerator;
5+
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
6+
import com.vaadin.event.LayoutEvents.LayoutClickListener;
67
import com.vaadin.server.FontAwesome;
78
import com.vaadin.shared.ui.label.ContentMode;
89
import com.vaadin.ui.Button;
@@ -18,7 +19,7 @@
1819
public class InlineTextEditor extends CustomComponent {
1920

2021
private final Property<String> property = new ObjectProperty<String>(
21-
DummyDataGenerator.randomText(30));
22+
"Enter text here...");
2223
private final Component editor;
2324
private final Component readOnly;
2425

@@ -52,6 +53,14 @@ public void buttonClick(ClickEvent event) {
5253
CssLayout result = new CssLayout(text, editButton);
5354
result.addStyleName("text-editor");
5455
result.setSizeFull();
56+
result.addLayoutClickListener(new LayoutClickListener() {
57+
@Override
58+
public void layoutClick(LayoutClickEvent event) {
59+
if (event.getChildComponent() == text && event.isDoubleClick()) {
60+
setCompositionRoot(editor);
61+
}
62+
}
63+
});
5564
return result;
5665
}
5766

src/main/java/com/vaadin/demo/dashboard/view/reports/ReportEditor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ public void addComponent(PaletteItemType paletteItemType,
167167
if (placeholder.getParent() != null) {
168168
layout.removeComponent(placeholder);
169169
}
170-
layout.addComponent(new WrappedComponent(
171-
createComponentFromPaletteItem(paletteItemType, prefillData)));
170+
layout.addComponent(
171+
new WrappedComponent(createComponentFromPaletteItem(
172+
paletteItemType, prefillData)), 1);
172173
}
173174

174175
private Component createComponentFromPaletteItem(PaletteItemType type,

src/main/webapp/VAADIN/themes/dashboard/views/reports.scss

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,24 @@
2929
}
3030
}
3131

32+
.v-slot-palette {
33+
@include valo-gradient;
34+
border-bottom: valo-border();
35+
}
36+
3237
.palette {
33-
padding: 0;
38+
padding: .5em 0;
39+
font-size: 0.9em;
40+
41+
.v-icon {
42+
display: block;
43+
text-align: center;
44+
}
3445

3546
.v-label {
36-
font-size: 14px;
47+
font-size: 0.9em;
48+
margin: 0 .4em;
49+
cursor: move;
3750
}
3851
}
3952

@@ -47,23 +60,24 @@
4760

4861
.v-slot-canvas {
4962
overflow: auto;
63+
}
5064

51-
.canvas {
52-
padding: $view-padding;
53-
54-
.title {
55-
font-size: 24px;
56-
font-weight: 600;
57-
border: 1px solid transparent;
58-
color: #404346;
59-
@include box-shadow(none);
60-
width: 100%;
61-
text-align: center;
62-
cursor: pointer;
63-
margin-bottom: 1cm;
64-
}
65+
.canvas {
66+
padding: $view-padding;
67+
68+
.title {
69+
font-size: 24px;
70+
font-weight: 600;
71+
border: 1px solid transparent;
72+
color: #404346;
73+
@include box-shadow(none);
74+
width: 100%;
75+
text-align: center;
76+
cursor: pointer;
77+
margin-bottom: 1cm;
6578
}
6679
}
80+
6781
}
6882

6983
.reports .palette .v-image {
@@ -78,6 +92,15 @@
7892
padding: 1.5cm;
7993

8094
@include box-shadow(0 2px 10px rgba(0,0,0,.3));
95+
96+
> .v-slot > .v-widget {
97+
@include animation(valo-animate-in-fade 500ms 10ms backwards, animate-in-scale-up 300ms 10ms backwards);
98+
99+
&.title,
100+
&.placeholder {
101+
@include animation(none);
102+
}
103+
}
81104
}
82105

83106
.reports .canvas .title:hover {

0 commit comments

Comments
 (0)