Skip to content

Commit 61d6c19

Browse files
silverwindlunny
andauthored
Improve migrate page and add card CSS (#13751)
- Use original gitea logo on migrate page - Add card styles and map colors to css vars - Tweak migrate page, adding hover effect to cards Co-authored-by: Lunny Xiao <[email protected]>
1 parent 1a768e5 commit 61d6c19

File tree

8 files changed

+83
-54
lines changed

8 files changed

+83
-54
lines changed

build/generate-svg.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ function exit(err) {
1414
process.exit(err ? 1 : 0);
1515
}
1616

17-
async function processFile(file, {prefix = ''} = {}) {
18-
let name = parse(file).name;
19-
if (prefix) name = `${prefix}-${name}`;
20-
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
17+
async function processFile(file, {prefix, fullName} = {}) {
18+
let name;
19+
20+
if (fullName) {
21+
name = fullName;
22+
} else {
23+
name = parse(file).name;
24+
if (prefix) name = `${prefix}-${name}`;
25+
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
26+
}
2127

2228
const svgo = new Svgo({
2329
plugins: [
@@ -47,18 +53,20 @@ async function processFile(file, {prefix = ''} = {}) {
4753
await writeFile(resolve(outputDir, `${name}.svg`), data);
4854
}
4955

56+
function processFiles(pattern, opts) {
57+
return glob(pattern).map((file) => processFile(file, opts));
58+
}
59+
5060
async function main() {
5161
try {
5262
await mkdir(outputDir);
5363
} catch {}
5464

55-
for (const file of glob('../node_modules/@primer/octicons/build/svg/*-16.svg')) {
56-
await processFile(file, {prefix: 'octicon'});
57-
}
58-
59-
for (const file of glob('../web_src/svg/*.svg')) {
60-
await processFile(file);
61-
}
65+
await Promise.all([
66+
...processFiles('../node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
67+
...processFiles('../web_src/svg/*.svg'),
68+
...processFiles('../assets/logo.svg', {fullName: 'gitea-gitea'}),
69+
]);
6270
}
6371

6472
main().then(exit).catch(exit);

public/img/svg/gitea-gitea.svg

Lines changed: 1 addition & 1 deletion
Loading

templates/repo/migrate/migrate.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
<div class="column">
55
<div class="ui three stackable cards">
66
{{range .Services}}
7-
<div class="ui card">
8-
<a class="image" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
9-
{{svg (Printf "gitea-%s" .Name) 184}}
10-
</a>
7+
<a class="ui card df ac" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
8+
{{svg (Printf "gitea-%s" .Name) 184}}
119
<div class="content">
12-
<a class="header" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">{{.Title}}</a>
13-
<div class="description">
10+
<div class="header tc">
11+
{{.Title}}
12+
</div>
13+
<div class="description tc">
1414
{{(Printf "repo.migrate.%s.description" .Name) | $.i18n.Tr }}
1515
</div>
1616
</div>
17-
</div>
17+
</a>
1818
{{end}}
1919
</div>
2020
</div>

web_src/less/_base.less

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@
9494
--color-hover: #0000000a;
9595
--color-active: #00000010;
9696
--color-menu: #ffffff;
97+
--color-card: #ffffff;
9798
--color-markdown-table-row: #00000008;
9899
--color-markdown-code-block: #00000010;
99100
--color-button: #ffffff;
100101
--color-code-bg: #ffffff;
102+
--color-shadow: #00000024;
101103
}
102104

103105
:root:lang(ja) {
@@ -374,6 +376,48 @@ a.muted:hover,
374376
box-shadow: -1px -1px 0 0 var(--color-secondary);
375377
}
376378

379+
.ui.cards > .card,
380+
.ui.card {
381+
background: var(--color-card);
382+
border: 1px solid var(--color-secondary);
383+
box-shadow: none;
384+
}
385+
386+
.ui.cards > .card > .content,
387+
.ui.card > .content {
388+
border-color: var(--color-secondary);
389+
}
390+
391+
.ui.cards > .card > .extra,
392+
.ui.card > .extra,
393+
.ui.cards > .card > .extra a:not(.ui),
394+
.ui.card > .extra a:not(.ui) {
395+
color: var(--color-text);
396+
}
397+
398+
.ui.cards > .card > .extra a:not(.ui):hover,
399+
.ui.card > .extra a:not(.ui):hover {
400+
color: var(--color-primary);
401+
}
402+
403+
.ui.cards > .card > .content > .header,
404+
.ui.card > .content > .header {
405+
color: var(--color-text);
406+
}
407+
408+
.ui.cards > .card > .content > .description,
409+
.ui.card > .content > .description {
410+
color: var(--color-text);
411+
}
412+
413+
.ui.cards a.card:hover,
414+
.ui.link.cards .card:not(.icon):hover,
415+
a.ui.card:hover,
416+
.ui.link.card:hover {
417+
border: 1px solid var(--color-secondary);
418+
background: var(--color-card);
419+
}
420+
377421
.ui.progress[data-percent="0"] .bar .progress {
378422
color: var(--color-text);
379423
}

web_src/less/_repository.less

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3206,6 +3206,13 @@ td.blob-excerpt {
32063206
}
32073207
}
32083208

3209-
.migrate .cards .card {
3210-
text-align: center;
3209+
.repository.migrate .card {
3210+
transition: all .1s ease-in-out;
3211+
box-shadow: none !important;
3212+
border: 1px solid var(--color-secondary);
3213+
}
3214+
3215+
.repository.migrate .card:hover {
3216+
transform: scale(105%);
3217+
box-shadow: 0 .5rem 1rem var(--color-shadow) !important;
32113218
}

web_src/less/helpers.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.df { display: flex !important; }
22
.dif { display: inline-flex !important; }
33
.ac { align-items: center !important; }
4+
.tc { text-align: center !important; }
45
.jc { justify-content: center !important; }
56
.js { justify-content: flex-start !important; }
67
.je { justify-content: flex-end !important; }

web_src/less/themes/theme-arc-green.less

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@
8989
--color-hover: #ffffff0d;
9090
--color-active: #ffffff14;
9191
--color-menu: #2e323e;
92+
--color-card: #2e323e;
9293
--color-markdown-table-row: #ffffff06;
9394
--color-markdown-code-block: #2a2e3a;
9495
--color-button: #353846;
9596
--color-code-bg: #2a2e3a;
97+
--color-shadow: #00000060;
9698
}
9799

98100
/* LineTableTD */
@@ -817,22 +819,6 @@ td.blob-hunk {
817819
background: #353945;
818820
}
819821

820-
.ui.card,
821-
.ui.cards > .card {
822-
background: #353945;
823-
box-shadow: 0 0 0 1px var(--color-secondary);
824-
}
825-
826-
.ui.card > .content > .header,
827-
.ui.cards > .card > .content > .header {
828-
color: #dbdbdb;
829-
}
830-
831-
.ui.card > .extra a:not(.ui),
832-
.ui.cards > .card > .extra a:not(.ui) {
833-
color: #87ab63;
834-
}
835-
836822
.ui .text.black {
837823
color: var(--color-secondary-dark-6);
838824
}
@@ -1366,19 +1352,3 @@ img[src$="/img/matrix.svg"] {
13661352
border: 1px solid rgba(121, 71, 66, .5) !important;
13671353
border-bottom: none !important;
13681354
}
1369-
1370-
.migrate .cards .card {
1371-
text-align: center;
1372-
}
1373-
1374-
.migrate .cards .card .content a {
1375-
color: rgb(158, 158, 158) !important;
1376-
}
1377-
1378-
.migrate .cards .card .content a:hover {
1379-
color: rgb(255, 255, 255) !important;
1380-
}
1381-
1382-
.migrate .cards .card .content .description {
1383-
color: rgb(158, 158, 158);
1384-
}

web_src/svg/gitea-gitea.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)