Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions styles/public/dropdown/selection_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { activeItemAfterStyle } from "@lutinglt/gitea-github-theme/styles/common
// 选择框的下拉菜单看起来像普通按钮
const selectionDropdown = css`
/* 排除可搜索输入框和 Forgejo 15 的仓库拥有者选择框 */
.ui.selection.dropdown:not(.search):not(:has(> #uid)),
.ui.selection.dropdown.active:not(.search):not(:has(> #uid)) {
.ui.selection.dropdown:not(.search):not(:has(> #uid)):not(.theme-search-control .dropdown),
.ui.selection.dropdown.active:not(.search):not(:has(> #uid)):not(.theme-search-control .dropdown) {
background-color: ${themeVars.color.button};
border-color: ${themeVars.color.light.border};
border-radius: ${otherThemeVars.border.radius};
Expand Down
95 changes: 94 additions & 1 deletion styles/public/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,97 @@ const checkBoxAndRadio = css`
}
`;

export default cssCombine(input, checkBoxAndRadio);
// Opt-in search group for native Forgejo query/mode/submit controls.
const searchControl = css`
.ui.form.theme-search-control > .ui.action.input {
display: flex;
align-items: stretch;
height: 32px;
min-width: 0;
border: 1px solid ${themeVars.color.light.border};
border-radius: ${otherThemeVars.border.radius};
background: ${themeVars.color.body};
box-shadow: none;
&:has(> input:focus-visible) {
outline: 2px solid ${themeVars.github.fgColor.accent};
outline-offset: -1px;
}
& > input[type="search"] {
min-width: 0;
width: 0;
flex: 1 1 0;
height: 30px;
padding: 5px 12px;
font-size: 14px;
line-height: 20px;
background: transparent;
border: 0;
border-radius: inherit;
box-shadow: none;
outline: none;
}
& > .ui.selection.dropdown,
& > .ui.button {
flex: 0 0 auto;
height: 30px;
min-height: 30px;
margin: 0;
border: 0;
border-left: 1px solid ${themeVars.color.light.border};
border-radius: 0;
background: transparent;
box-shadow: none;
color: ${themeVars.color.text.light.num1};
&:hover {
background: ${themeVars.color.hover.self};
}
&:focus-visible {
outline: 2px solid ${themeVars.github.fgColor.accent};
outline-offset: -2px;
}
}
& > .ui.selection.dropdown {
display: flex;
align-items: center;
width: auto;
min-width: 88px;
padding: 5px 28px 5px 8px;
font-size: 12px;
line-height: 20px;
& > .text {
margin: 0;
line-height: 20px;
}
& > .dropdown.icon {
top: 50%;
transform: translateY(-50%);
right: 8px;
padding: 0;
margin: 0;
width: 16px;
height: 16px;
}
& > .menu {
left: auto;
right: 0;
width: 200px;
min-width: 200px;
margin-top: 4px;
}
}
& > .ui.button {
display: grid;
place-items: center;
width: 32px;
padding: 0 !important;
border-radius: 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0;
& > svg {
width: 16px;
height: 16px;
margin: 0;
}
}
}
`;

export default cssCombine(input, checkBoxAndRadio, searchControl);
10 changes: 10 additions & 0 deletions styles/templates/repo/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ const repositoryHome = css`
border-bottom: 1px solid ${themeVars.color.light.border};
}
.page-content.repository.file.list .repo-button-row {
position: relative;
flex-wrap: nowrap;
align-items: center;
}
Expand All @@ -246,6 +247,15 @@ const repositoryHome = css`
.page-content.repository.file.list .repo-button-row .repo-add-file {
display: none;
}
.page-content.repository.file.list .repo-code-dropdown {
position: static;
}
.page-content.repository.file.list .repo-button-row .repo-code-dropdown > .content {
left: 0;
right: 0;
top: 100%;
width: auto;
}
.page-content.repository.file.list .repo-code-dropdown > summary > span {
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/view_content.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
{{if and (not (StringUtils.HasPrefix .BranchNameSubURL "commit")) (or .CodeIndexerDisabled (and (not .TagName) (eq .Repository.DefaultBranch .BranchName)))}}
<details class="repo-code-search">
<summary>{{svg "octicon-search" 16}}Search code</summary>
<form class="ui form ignore-dirty" action="{{.RepoLink}}/search/{{if .CodeIndexerDisabled}}{{.BranchNameSubURL}}{{end}}" method="get" data-test-tag="codesearch">
<form class="ui form ignore-dirty theme-search-control" action="{{.RepoLink}}/search/{{if .CodeIndexerDisabled}}{{.BranchNameSubURL}}{{end}}" method="get" data-test-tag="codesearch">
<input type="hidden" name="path" value="{{.TreePath | PathEscapeSegments}}">
{{template "shared/search/combo_multi"
dict
Expand Down
Loading