Skip to content

Commit f49a1bd

Browse files
authored
Refine Home page (jenkinsci#432)
1 parent 9f18caa commit f49a1bd

File tree

4 files changed

+98
-93
lines changed

4 files changed

+98
-93
lines changed

src/main/java/io/jenkins/plugins/designlibrary/Home.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import hudson.model.RootAction;
66
import java.util.List;
77
import java.util.Map;
8+
import java.util.concurrent.ThreadLocalRandom;
89
import jenkins.model.Jenkins;
910

1011
/**
@@ -61,4 +62,46 @@ public String getPluginVersion() {
6162
}
6263
return "Version not available";
6364
}
65+
66+
/**
67+
* Generates a dynamic gradient for the Home cards
68+
*/
69+
public String buildGradientVar() {
70+
return GradientFactory.buildGradientVar();
71+
}
72+
73+
private static final class GradientFactory {
74+
75+
private static final int LAYERS = 10;
76+
77+
private static final String[] COLOURS = {
78+
"var(--light-orange)",
79+
"var(--light-cyan)",
80+
"var(--light-pink)",
81+
"var(--light-red)",
82+
"var(--light-yellow)",
83+
"var(--light-purple)",
84+
"var(--light-teal)",
85+
"var(--light-indigo)",
86+
"var(--light-brown)"
87+
};
88+
89+
private GradientFactory() {}
90+
91+
public static String buildGradientVar() {
92+
StringBuilder css = new StringBuilder("--aurora").append(": \n ");
93+
94+
ThreadLocalRandom rnd = ThreadLocalRandom.current();
95+
for (int i = 0; i < LAYERS; i++) {
96+
int x = rnd.nextInt(101);
97+
int y = rnd.nextInt(101);
98+
String colour = COLOURS[rnd.nextInt(COLOURS.length)];
99+
100+
css.append(String.format("radial-gradient(at %d%% %d%%, %s 0, transparent 50%%)", x, y, colour));
101+
102+
css.append(i < LAYERS - 1 ? ",\n " : ";");
103+
}
104+
return css.toString();
105+
}
106+
}
64107
}

src/main/resources/io/jenkins/plugins/designlibrary/Home/index.jelly

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@
88
</l:side-panel>
99

1010
<l:main-panel>
11+
<style>
12+
:root {
13+
${it.buildGradientVar()}
14+
}
15+
</style>
16+
1117
<s:section hideBorder="true">
1218
<div class="app-card__container app-card__container--large">
1319
<div class="app-card__preview">
1420
<div class="app-card__preview__introduction">
1521
<img src="${imagesURL}/svgs/logo.svg" alt="${%Jenkins illustration}" />
1622
</div>
1723
</div>
18-
<p class="jdl-section__title">${%welcome}</p>
19-
<p class="jdl-section__description">${%description}</p>
24+
<p class="app-card__title">${%welcome}</p>
25+
<p class="app-card__description">${%description}</p>
2026
</div>
2127
</s:section>
2228

src/main/resources/scss/abstracts/_overrides.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:root {
22
--jdl-spacing: var(--section-padding);
33
--jdl-border-translucent: var(--jenkins-border-width) solid
4-
color-mix(in srgb, var(--text-color-secondary) 9%, transparent);
4+
color-mix(in srgb, var(--text-color-secondary) 10%, transparent);
55
--jdl-box-shadow:
66
0 0 0 var(--jenkins-border-width)
77
color-mix(in srgb, currentColor 5%, transparent),
Lines changed: 46 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
@use "../abstracts/mixins";
22

3+
@mixin aurora-background {
4+
background-attachment: fixed;
5+
background-color: var(--light-pink);
6+
background-image: var(--aurora);
7+
opacity: 0.3;
8+
9+
@media (prefers-reduced-motion: no-preference) {
10+
animation: aurora-one 10s linear infinite;
11+
}
12+
}
13+
14+
@property --rotation {
15+
syntax: "<angle>";
16+
initial-value: 0deg;
17+
inherits: false;
18+
}
19+
320
.app-home__side-by-side {
421
position: relative;
522
display: grid;
@@ -19,17 +36,12 @@
1936
flex-direction: column;
2037
color: var(--text-color) !important;
2138
text-decoration: none !important;
22-
gap: 0.15rem;
39+
gap: 0.75rem;
2340

2441
&--large {
25-
gap: var(--jdl-spacing);
26-
27-
.jdl-section__title {
28-
margin-bottom: calc(var(--jdl-spacing) * -0.25);
29-
}
30-
31-
.jdl-section__description {
32-
font-size: 1rem;
42+
.app-card__title {
43+
font-size: 1.125rem;
44+
margin-top: 0.25rem;
3345
}
3446
}
3547

@@ -93,107 +105,42 @@
93105
display: inline-block;
94106
position: relative;
95107
width: 100%;
96-
margin: -10%;
97108
aspect-ratio: 1;
98109
backdrop-filter: invert(2%) blur(100px);
99110
mask-image: repeating-conic-gradient(
100-
from 90deg,
111+
from var(--rotation),
101112
var(--background) 0deg,
102113
transparent 20deg
103114
);
115+
z-index: -1;
116+
opacity: 0.85;
117+
104118
@media (prefers-reduced-motion: no-preference) {
105119
animation: sunburst-rotation 100s infinite linear;
106120
}
107-
& {
108-
z-index: -1;
109-
opacity: 0.4;
110-
border-radius: 100%;
111-
flex: 1;
112-
}
113121
}
114122
}
115123

116124
@keyframes sunburst-rotation {
117125
to {
118-
transform: rotate(360deg);
126+
--rotation: 360deg;
119127
}
120128
}
121129

122130
.app-card__preview {
123-
&::before,
124-
&::after {
131+
&::before {
132+
@include aurora-background();
133+
125134
content: "";
126135
position: absolute;
127136
inset: 0;
128137
z-index: -1;
129-
background-attachment: fixed;
130-
background-size: max(950px, 65vw) 100vh;
131-
background-repeat: no-repeat;
132-
--sidebar-width: 340px;
133-
--content-width: max(950px, 65vw);
134-
background-position-x: calc(
135-
var(--sidebar-width) +
136-
((100vw - (var(--content-width) + var(--sidebar-width))) / 2)
137-
);
138-
opacity: 0.25;
139-
140-
@media (max-width: 970px) {
141-
--sidebar-width: 0;
142-
--content-width: 100%;
143-
background-size: 100%;
144-
}
145-
}
146-
147-
&::before {
148-
background-image:
149-
radial-gradient(at 40% 20%, var(--light-orange) 0, transparent 50%),
150-
radial-gradient(at 80% 0%, var(--light-cyan) 0, transparent 50%),
151-
radial-gradient(at 0% 50%, var(--light-pink) 0, transparent 50%),
152-
radial-gradient(at 80% 50%, var(--light-red) 0, transparent 50%),
153-
radial-gradient(at 0% 100%, var(--light-yellow) 0, transparent 50%),
154-
radial-gradient(at 80% 100%, var(--light-purple) 0, transparent 50%),
155-
radial-gradient(at 0% 0%, var(--light-pink) 0, transparent 50%);
156-
@media (prefers-reduced-motion: no-preference) {
157-
animation: aurora-one 5s linear infinite;
158-
}
159-
}
160-
161-
&::after {
162-
background-image:
163-
radial-gradient(at 40% 20%, var(--light-cyan) 0, transparent 50%),
164-
radial-gradient(at 80% 0%, var(--light-orange) 0, transparent 50%),
165-
radial-gradient(at 0% 50%, var(--light-blue) 0, transparent 50%),
166-
radial-gradient(at 80% 50%, var(--light-green) 0, transparent 50%),
167-
radial-gradient(at 0% 100%, var(--light-red) 0, transparent 50%),
168-
radial-gradient(at 80% 100%, var(--light-yellow) 0, transparent 50%),
169-
radial-gradient(at 0% 0%, var(--light-cyan) 0, transparent 50%);
170-
@media (prefers-reduced-motion: no-preference) {
171-
animation: aurora-two 8s linear infinite;
172-
}
173138
}
174139
}
175140

176141
@keyframes aurora-one {
177-
0% {
178-
opacity: 0.2;
179-
}
180-
50% {
181-
opacity: 0.55;
182-
}
183-
100% {
184-
opacity: 0.2;
185-
}
186-
}
187-
188-
@keyframes aurora-two {
189-
0% {
190-
opacity: 0.55;
191-
}
192142
50% {
193-
opacity: 0.1;
194-
}
195-
100% {
196-
opacity: 0.55;
143+
filter: hue-rotate(180deg);
197144
}
198145
}
199146

@@ -202,33 +149,42 @@
202149
display: inline-flex;
203150
font-size: 1rem;
204151
align-items: center;
205-
font-weight: 450;
206-
gap: 1.15rem;
207-
margin: 0.6rem 0 0;
152+
font-weight: var(--font-bold-weight);
153+
gap: 1.125rem;
154+
margin: 0;
155+
text-box: cap alphabetic;
208156
}
209157

210158
.app-card__new-tag {
211159
@include mixins.base-text;
212160
position: relative;
213161
margin: 0;
214162
font-size: 0.75rem;
215-
font-weight: 500;
163+
font-weight: var(--font-bold-weight);
216164
z-index: 0;
217-
color: var(--background);
218165

219-
&::before {
166+
&::before,
167+
&::after {
220168
content: "";
221169
position: absolute;
222170
inset: -1px -8px;
223171
border-radius: 100px;
224-
background: var(--text-color);
225172
z-index: -1;
226173
}
174+
175+
&::before {
176+
@include aurora-background();
177+
}
178+
179+
&::after {
180+
border: var(--jdl-border-translucent);
181+
}
227182
}
228183

229184
.app-card__description {
230185
@include mixins.base-text;
231186
font-size: 1rem;
232187
margin: 0;
233188
color: var(--text-color-secondary);
189+
text-box: cap alphabetic;
234190
}

0 commit comments

Comments
 (0)