Skip to content

Commit db370c4

Browse files
GiteaBotsilverwind
andauthored
Add --page-spacing variable, fix admin dashboard notice (#30302) (#30323)
Backport #30302 by @silverwind Fixes #30293 and introduce the `--page-spacing` variable which holds the spacing between the elements on the page. This is working vertically for all pages, including ones that have fomantic grid, and horizontally for all that use `flex-container`. The `.page-content > :first-child:not(.secondary-nav)` selector uses margin which in some cases enables to adjacent margins to overlap, which is nice. <img width="1320" alt="Screenshot 2024-04-06 at 01 35 19" src="https://github.com/go-gitea/gitea/assets/115237/3e81e707-e9ff-4b7f-a211-3d98f4f85353"> --- <img width="1327" alt="Screenshot 2024-04-06 at 01 35 45" src="https://github.com/go-gitea/gitea/assets/115237/aad196c0-9e21-4c06-ae59-7e33a76c61e1"> --- <img width="1321" alt="Screenshot 2024-04-06 at 01 35 31" src="https://github.com/go-gitea/gitea/assets/115237/785f6c5d-08b6-4e66-aa16-aeca7cfed3ad"> Co-authored-by: silverwind <[email protected]>
1 parent cc95def commit db370c4

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

templates/user/notification/notification_div.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-sequence-number="{{.SequenceNumber}}">
22
<div class="ui container">
33
{{$notificationUnreadCount := call .NotificationUnreadCount}}
4-
<div class="tw-flex tw-items-center tw-justify-between tw-mb-4">
4+
<div class="tw-flex tw-items-center tw-justify-between tw-mb-[--page-spacing]">
55
<div class="small-menu-items ui compact tiny menu">
66
<a class="{{if eq .Status 1}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=unread">
77
{{ctx.Locale.Tr "notification.unread"}}

web_src/css/base.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
--min-height-textarea: 132px; /* padding + 6 lines + border = calc(1.57142em + 6lh + 2px), but lh is not fully supported */
2525
--tab-size: 4;
2626
--checkbox-size: 16px; /* height and width of checkbox and radio inputs */
27+
--page-spacing: 16px; /* space between page elements */
2728
}
2829

2930
:root * {
@@ -656,11 +657,14 @@ img.ui.avatar,
656657
margin-bottom: 14px;
657658
}
658659

659-
/* add padding to all content when there is no .secondary.nav. this uses padding instead of
660-
margin because with the negative margin on .ui.grid we would have to set margin-top: 0,
661-
but that does not work universally for all pages */
660+
/* add margin to all pages when there is no .secondary.nav */
662661
.page-content > :first-child:not(.secondary-nav) {
663-
padding-top: 14px;
662+
margin-top: var(--page-spacing);
663+
}
664+
/* if .ui.grid is the first child the first grid-column has 'padding-top: 1rem' which we need
665+
to compensate here */
666+
.page-content > :first-child.ui.grid {
667+
margin-top: calc(var(--page-spacing) - 1rem);
664668
}
665669

666670
.ui.pagination.menu .active.item {

web_src/css/modules/flexcontainer.css

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

33
.flex-container {
44
display: flex !important;
5-
gap: 16px;
5+
gap: var(--page-spacing);
6+
margin-top: var(--page-spacing);
67
}
78

89
.flex-container-nav {

0 commit comments

Comments
 (0)