Skip to content

Commit b657409

Browse files
authored
Fix project column title overflow (#31011)
By the way: * Re-format the "color.go" to Golang code style * Remove unused `overflow-y: scroll;` from `.project-column` because there is `overflow: visible`
1 parent 47accfe commit b657409

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

modules/util/color.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright 2023 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
3+
34
package util
45

56
import (
@@ -8,7 +9,7 @@ import (
89
"strings"
910
)
1011

11-
// Get color as RGB values in 0..255 range from the hex color string (with or without #)
12+
// HexToRBGColor parses color as RGB values in 0..255 range from the hex color string (with or without #)
1213
func HexToRBGColor(colorString string) (float64, float64, float64) {
1314
hexString := colorString
1415
if strings.HasPrefix(colorString, "#") {
@@ -35,7 +36,7 @@ func HexToRBGColor(colorString string) (float64, float64, float64) {
3536
return r, g, b
3637
}
3738

38-
// Returns relative luminance for a SRGB color - https://en.wikipedia.org/wiki/Relative_luminance
39+
// GetRelativeLuminance returns relative luminance for a SRGB color - https://en.wikipedia.org/wiki/Relative_luminance
3940
// Keep this in sync with web_src/js/utils/color.js
4041
func GetRelativeLuminance(color string) float64 {
4142
r, g, b := HexToRBGColor(color)
@@ -46,8 +47,8 @@ func UseLightText(backgroundColor string) bool {
4647
return GetRelativeLuminance(backgroundColor) < 0.453
4748
}
4849

49-
// Given a background color, returns a black or white foreground color that the highest
50-
// contrast ratio. In the future, the APCA contrast function, or CSS `contrast-color` will be better.
50+
// ContrastColor returns a black or white foreground color that the highest contrast ratio.
51+
// In the future, the APCA contrast function, or CSS `contrast-color` will be better.
5152
// https://github.com/color-js/color.js/blob/eb7b53f7a13bb716ec8b28c7a56f052cd599acd9/src/contrast/APCA.js#L42
5253
func ContrastColor(backgroundColor string) string {
5354
if UseLightText(backgroundColor) {

templates/projects/view.tmpl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,14 @@
6868
{{range .Columns}}
6969
<div class="ui segment project-column"{{if .Color}} style="background: {{.Color}} !important; color: {{ContrastColor .Color}} !important"{{end}} data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
7070
<div class="project-column-header{{if $canWriteProject}} tw-cursor-grab{{end}}">
71-
<div class="ui large label project-column-title tw-py-1">
72-
<div class="ui small circular grey label project-column-issue-count">
73-
{{.NumIssues ctx}}
74-
</div>
75-
<span class="project-column-title-label">{{.Title}}</span>
71+
<div class="ui circular label project-column-issue-count">
72+
{{.NumIssues ctx}}
7673
</div>
74+
<div class="project-column-title-label gt-ellipsis">{{.Title}}</div>
7775
{{if $canWriteProject}}
78-
<div class="ui dropdown jump item">
79-
<div class="tw-px-2">
80-
{{svg "octicon-kebab-horizontal"}}
81-
</div>
82-
<div class="menu user-menu">
76+
<div class="ui dropdown tw-p-1">
77+
{{svg "octicon-kebab-horizontal"}}
78+
<div class="menu">
8379
<a class="item show-modal button" data-modal="#edit-project-column-modal-{{.ID}}">
8480
{{svg "octicon-pencil"}}
8581
{{ctx.Locale.Tr "repo.projects.column.edit"}}

web_src/css/features/projects.css

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
width: 320px;
1515
height: calc(100vh - 450px);
1616
min-height: 60vh;
17-
overflow-y: scroll;
1817
flex: 0 0 auto;
1918
overflow: visible;
2019
display: flex;
@@ -30,17 +29,15 @@
3029
display: flex;
3130
align-items: center;
3231
justify-content: space-between;
32+
gap: 0.5em;
3333
}
3434

35-
.project-column-title {
36-
background: none !important;
37-
line-height: 1.25 !important;
38-
cursor: inherit;
35+
.ui.label.project-column-issue-count {
36+
color: inherit;
3937
}
4038

41-
.project-column-title,
42-
.project-column-issue-count {
43-
color: inherit !important;
39+
.project-column-title-label {
40+
flex: 1;
4441
}
4542

4643
.project-column > .cards {

0 commit comments

Comments
 (0)