Skip to content

Commit

Permalink
Repo button row tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Apr 23, 2024
1 parent 2ee93ea commit b5677da
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion templates/repo/clone_buttons.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
SSH
</button>
{{end}}
<input id="repo-clone-url" size="20" class="js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly>
<input id="repo-clone-url" size="10" class="js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly>
<button class="ui small icon button" id="clipboard-btn" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" data-clipboard-target="#repo-clone-url" aria-label="{{ctx.Locale.Tr "copy_url"}}">
{{svg "octicon-copy" 14}}
</button>
12 changes: 6 additions & 6 deletions templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{{$l := Eval $n "-" 1}}
{{$isHomepage := (eq $n 0)}}
<div class="repo-button-row">
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-y-2">
<div class="repo-button-row-left tw-flex tw-flex-1 tw-items-center tw-gap-2">
{{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mr-1"}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
Expand All @@ -66,7 +66,7 @@
{{end}}

{{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}}
<button class="ui dropdown basic compact jump button tw-mr-1"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
<button class="ui dropdown basic compact jump button"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
{{ctx.Locale.Tr "repo.editor.add_file"}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
Expand Down Expand Up @@ -104,14 +104,14 @@
</span>
{{end}}

<form class="ignore-dirty" action="{{.RepoLink}}/search" method="get">
<div class="ui small action input">
<input name="q" value="{{.Keyword}}" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
<form class="tw-flex tw-flex-1" class="ignore-dirty" action="{{.RepoLink}}/search" method="get">
<div class="ui small action input tw-flex-1">
<input name="q" value="{{.Keyword}}" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
{{template "shared/search/button"}}
</div>
</form>
</div>
<div class="tw-flex tw-items-center">
<div class="repo-button-row-right tw-flex tw-flex-1 tw-items-center">
<!-- Only show clone panel in repository home page -->
{{if $isHomepage}}
<div class="clone-panel ui action tiny input">
Expand Down
4 changes: 2 additions & 2 deletions web_src/css/modules/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@
.ui.action.input:not([class*="left action"]) > input:focus + .ui.dropdown.selection:hover,
.ui.action.input:not([class*="left action"]) > input:focus + .button,
.ui.action.input:not([class*="left action"]) > input:focus + .button:hover,
.ui.action.input:not([class*="left action"]) > input:focus + .icon + .button,
.ui.action.input:not([class*="left action"]) > input:focus + .icon + .button:hover {
.ui.action.input:not([class*="left action"]) > input:focus + i.icon + .button,
.ui.action.input:not([class*="left action"]) > input:focus + i.icon + .button:hover {
border-left-color: var(--color-primary);
}
.ui.action.input:not([class*="left action"]) > input:focus {
Expand Down
41 changes: 31 additions & 10 deletions web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,22 @@
margin-bottom: 12px;
}

.repository .clone-panel #repo-clone-url {
width: 320px;
border-radius: 0;
.repository .clone-panel {
display: flex;
flex: 1;
}

@media (max-width: 991.98px) {
.repository .clone-panel #repo-clone-url {
width: 200px;
}
.repository.wiki .clone-panel {
flex: 0;
}

.repository.wiki .clone-panel input {
width: 20ch;
}

.repository .clone-panel #repo-clone-url {
border-radius: 0;
flex: 1;
}

.repository .ui.action.input.clone-panel > button + button,
Expand Down Expand Up @@ -2234,17 +2241,25 @@ td .commit-summary {
}

.repo-button-row {
margin: 10px 0;
margin: 8px 0;
display: flex;
align-items: center;
gap: 0.5em;
flex-wrap: wrap;
gap: 8px;
justify-content: space-between;
}

@media (max-width: 991px) {
.repository:not(.wiki) .repo-button-row {
flex-direction: column;
align-items: stretch;
}
}

.repo-button-row .button {
padding: 6px 10px !important;
height: 30px;
flex-shrink: 0;
margin: 0;
}

.repo-button-row .button.dropdown:not(.icon) {
Expand All @@ -2255,6 +2270,12 @@ td .commit-summary {
height: 30px;
}

@media (max-width: 600px) {
.repo-button-row-left {
flex-wrap: wrap;
}
}

tbody.commit-list {
vertical-align: baseline;
}
Expand Down

0 comments on commit b5677da

Please sign in to comment.