Skip to content

Commit

Permalink
Improve migrate page and add card CSS (#13751)
Browse files Browse the repository at this point in the history
- 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 <xiaolunwen@gmail.com>
  • Loading branch information
silverwind and lunny committed Dec 5, 2020
1 parent 1a768e5 commit 61d6c19
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 54 deletions.
30 changes: 19 additions & 11 deletions build/generate-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ function exit(err) {
process.exit(err ? 1 : 0);
}

async function processFile(file, {prefix = ''} = {}) {
let name = parse(file).name;
if (prefix) name = `${prefix}-${name}`;
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
async function processFile(file, {prefix, fullName} = {}) {
let name;

if (fullName) {
name = fullName;
} else {
name = parse(file).name;
if (prefix) name = `${prefix}-${name}`;
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
}

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

function processFiles(pattern, opts) {
return glob(pattern).map((file) => processFile(file, opts));
}

async function main() {
try {
await mkdir(outputDir);
} catch {}

for (const file of glob('../node_modules/@primer/octicons/build/svg/*-16.svg')) {
await processFile(file, {prefix: 'octicon'});
}

for (const file of glob('../web_src/svg/*.svg')) {
await processFile(file);
}
await Promise.all([
...processFiles('../node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
...processFiles('../web_src/svg/*.svg'),
...processFiles('../assets/logo.svg', {fullName: 'gitea-gitea'}),
]);
}

main().then(exit).catch(exit);
Expand Down
2 changes: 1 addition & 1 deletion public/img/svg/gitea-gitea.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions templates/repo/migrate/migrate.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<div class="column">
<div class="ui three stackable cards">
{{range .Services}}
<div class="ui card">
<a class="image" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
{{svg (Printf "gitea-%s" .Name) 184}}
</a>
<a class="ui card df ac" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
{{svg (Printf "gitea-%s" .Name) 184}}
<div class="content">
<a class="header" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">{{.Title}}</a>
<div class="description">
<div class="header tc">
{{.Title}}
</div>
<div class="description tc">
{{(Printf "repo.migrate.%s.description" .Name) | $.i18n.Tr }}
</div>
</div>
</div>
</a>
{{end}}
</div>
</div>
Expand Down
44 changes: 44 additions & 0 deletions web_src/less/_base.less
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@
--color-hover: #0000000a;
--color-active: #00000010;
--color-menu: #ffffff;
--color-card: #ffffff;
--color-markdown-table-row: #00000008;
--color-markdown-code-block: #00000010;
--color-button: #ffffff;
--color-code-bg: #ffffff;
--color-shadow: #00000024;
}

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

.ui.cards > .card,
.ui.card {
background: var(--color-card);
border: 1px solid var(--color-secondary);
box-shadow: none;
}

.ui.cards > .card > .content,
.ui.card > .content {
border-color: var(--color-secondary);
}

.ui.cards > .card > .extra,
.ui.card > .extra,
.ui.cards > .card > .extra a:not(.ui),
.ui.card > .extra a:not(.ui) {
color: var(--color-text);
}

.ui.cards > .card > .extra a:not(.ui):hover,
.ui.card > .extra a:not(.ui):hover {
color: var(--color-primary);
}

.ui.cards > .card > .content > .header,
.ui.card > .content > .header {
color: var(--color-text);
}

.ui.cards > .card > .content > .description,
.ui.card > .content > .description {
color: var(--color-text);
}

.ui.cards a.card:hover,
.ui.link.cards .card:not(.icon):hover,
a.ui.card:hover,
.ui.link.card:hover {
border: 1px solid var(--color-secondary);
background: var(--color-card);
}

.ui.progress[data-percent="0"] .bar .progress {
color: var(--color-text);
}
Expand Down
11 changes: 9 additions & 2 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,13 @@ td.blob-excerpt {
}
}

.migrate .cards .card {
text-align: center;
.repository.migrate .card {
transition: all .1s ease-in-out;
box-shadow: none !important;
border: 1px solid var(--color-secondary);
}

.repository.migrate .card:hover {
transform: scale(105%);
box-shadow: 0 .5rem 1rem var(--color-shadow) !important;
}
1 change: 1 addition & 0 deletions web_src/less/helpers.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.df { display: flex !important; }
.dif { display: inline-flex !important; }
.ac { align-items: center !important; }
.tc { text-align: center !important; }
.jc { justify-content: center !important; }
.js { justify-content: flex-start !important; }
.je { justify-content: flex-end !important; }
Expand Down
34 changes: 2 additions & 32 deletions web_src/less/themes/theme-arc-green.less
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@
--color-hover: #ffffff0d;
--color-active: #ffffff14;
--color-menu: #2e323e;
--color-card: #2e323e;
--color-markdown-table-row: #ffffff06;
--color-markdown-code-block: #2a2e3a;
--color-button: #353846;
--color-code-bg: #2a2e3a;
--color-shadow: #00000060;
}

/* LineTableTD */
Expand Down Expand Up @@ -817,22 +819,6 @@ td.blob-hunk {
background: #353945;
}

.ui.card,
.ui.cards > .card {
background: #353945;
box-shadow: 0 0 0 1px var(--color-secondary);
}

.ui.card > .content > .header,
.ui.cards > .card > .content > .header {
color: #dbdbdb;
}

.ui.card > .extra a:not(.ui),
.ui.cards > .card > .extra a:not(.ui) {
color: #87ab63;
}

.ui .text.black {
color: var(--color-secondary-dark-6);
}
Expand Down Expand Up @@ -1366,19 +1352,3 @@ img[src$="/img/matrix.svg"] {
border: 1px solid rgba(121, 71, 66, .5) !important;
border-bottom: none !important;
}

.migrate .cards .card {
text-align: center;
}

.migrate .cards .card .content a {
color: rgb(158, 158, 158) !important;
}

.migrate .cards .card .content a:hover {
color: rgb(255, 255, 255) !important;
}

.migrate .cards .card .content .description {
color: rgb(158, 158, 158);
}
1 change: 0 additions & 1 deletion web_src/svg/gitea-gitea.svg

This file was deleted.

0 comments on commit 61d6c19

Please sign in to comment.