From 9b07108c44a13fe2401fbebb9ab4477616651b79 Mon Sep 17 00:00:00 2001 From: lutinglt Date: Thu, 3 Jul 2025 21:54:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=9C=86=E8=A7=92=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release.md | 1 + styles/public/index.tsx | 1 + styles/public/radius.scss | 98 -------------- styles/public/radius.tsx | 261 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 263 insertions(+), 98 deletions(-) delete mode 100644 styles/public/radius.scss create mode 100644 styles/public/radius.tsx diff --git a/.github/release.md b/.github/release.md index 9524021..c44b438 100644 --- a/.github/release.md +++ b/.github/release.md @@ -17,6 +17,7 @@ - 主色调按钮边框色同步 - 设置界面右上角小按钮样式同步 - 弹窗背景色和叠加背景色同步 +- 全局圆角样式同步 ## 🎈 Perf diff --git a/styles/public/index.tsx b/styles/public/index.tsx index 53ff0dc..761b86b 100644 --- a/styles/public/index.tsx +++ b/styles/public/index.tsx @@ -2,4 +2,5 @@ import "./button"; // 按钮 import "./chroma"; // 代码高亮 import "./input"; // 输入框 import "./modal"; // 弹窗 +import "./radius"; // 圆角 import "./svg"; // svg 图标 diff --git a/styles/public/radius.scss b/styles/public/radius.scss deleted file mode 100644 index 27cf5b4..0000000 --- a/styles/public/radius.scss +++ /dev/null @@ -1,98 +0,0 @@ -.ui { - &.button, - &.basic.buttons .button, - &.basic.button, - &.dropdown .menu, - &.form input:not([type]), - &.form input[type="date"], - &.form input[type="datetime-local"], - &.form input[type="email"], - &.form input[type="number"], - &.form input[type="password"], - &.form input[type="search"], - &.form input[type="tel"], - &.form input[type="time"], - &.form input[type="text"], - &.form input[type="file"], - &.form input[type="url"], - &.form textarea, - &.input textarea, - &.ui.input > input, - &.label, - &.menu, - &.segment, - &.segments, - &.segments:not(.horizontal) > .segment:only-child, - &.secondary.menu .dropdown.item > .menu, - &.selection.dropdown, - &.selection.dropdown .menu, - &.table, - &.text.menu .dropdown.item > .menu { - border-radius: var(--border-radius); - } - - .floating.dropdown > .menu { - border-radius: var(--border-radius) !important; - } - - .repository.view.issue .comment-list .comment > .content > div:last-child { - border-bottom-right-radius: var(--border-radius); - border-bottom-left-radius: var(--border-radius); - } -} - -/* 左边框圆角 */ -.ui { - &.action.input > .dropdown:first-child, - &.action.input > .button:first-child, - &.action.input > .buttons:first-child > .button, - &.compact.menu:not(.secondary) .item:first-child, - &.horizontal.segments > .segment:first-child { - border-radius: var(--border-radius) 0 0 var(--border-radius); - } -} - -/* 右边框圆角 */ -.ui { - &.action.input > .dropdown:last-child, - &.action.input > .button:last-child, - &.action.input > .buttons:last-child > .button, - &.compact.menu:not(.secondary) .item:last-child, - &.horizontal.segments > .segment:last-child { - border-radius: 0 var(--border-radius) var(--border-radius) 0; - } -} - -/* 上边框圆角 */ -.ui.secondary.pointing.menu { - .active.item, - .item:hover { - border-radius: var(--border-radius) !important; - } -} - -.ui.tabular.menu .active.item, -.repository.view.issue .comment-list .comment > .content > div:first-child { - border-top-left-radius: var(--border-radius) !important; - border-top-right-radius: var(--border-radius) !important; -} - -/* 按钮边框圆角 */ -.ui.active.selection.dropdown { - border-bottom-left-radius: var(--border-radius) !important; - border-bottom-right-radius: var(--border-radius) !important; -} - -.ui.segment[class*="bottom attached"] { - border-radius: 0 0 var(--border-radius) var(--border-radius); -} - -.ui.table > thead > tr:first-child > th { - &:first-child { - border-radius: var(--border-radius) 0 0; - } - - &:last-child { - border-radius: 0 var(--border-radius) 0 0; - } -} diff --git a/styles/public/radius.tsx b/styles/public/radius.tsx new file mode 100644 index 0000000..2459db2 --- /dev/null +++ b/styles/public/radius.tsx @@ -0,0 +1,261 @@ +import { css, otherThemeVars } from "src/types/vars"; + +// 全部圆角替换 +export const radius = css` + .ui.form textarea, + .ui.form input:not([type]), + .ui.form input[type="date"], + .ui.form input[type="datetime-local"], + .ui.form input[type="email"], + .ui.form input[type="number"], + .ui.form input[type="password"], + .ui.form input[type="search"], + .ui.form input[type="tel"], + .ui.form input[type="time"], + .ui.form input[type="text"], + .ui.form input[type="file"], + .ui.form input[type="url"] { + border-radius: ${otherThemeVars.border.radius}; + &:focus { + border-radius: ${otherThemeVars.border.radius}; + } + } + .ui.form select { + border-radius: ${otherThemeVars.border.radius}; + } + + .ui.input { + textarea, + input { + border-radius: ${otherThemeVars.border.radius}; + } + } + + .ui { + &.menu, + &.modal, + &.label, + &.table, + &.segment, + &.segments, + &.grid.segment &.selection.dropdown, + &.horizontal.segments, + &.active.empty.selection.dropdown { + border-radius: ${otherThemeVars.border.radius}; + } + } + + .ui.dropdown, + .ui.inline.dropdown, + .ui.pointing.upward.dropdown, + .ui.top.pointing.upward.dropdown { + .menu { + border-radius: ${otherThemeVars.border.radius}; + } + } + + .ui.search > .results, + .ui.search.selection .prompt, + .ui.pointing.dropdown > .menu, + .ui.loading.form.segments:before, + .ui.secondary.menu .item, + .ui.secondary.menu .active.item, + .ui.secondary.menu .dropdown.item > .menu, + .ui.vertical.menu > .active.item:only-child, + .ui.segments:not(.horizontal) > .segment:only-child, + .ui.segments:not(.horizontal) > .segment:has(~ .tw-hidden) { + border-radius: ${otherThemeVars.border.radius}; + } +`; + +// 全部圆角替换(原CSS带!important) +export const radiusImportant = css` + .ui.dropdown .menu .menu, + .ui.dropdown .menu .left.menu, + .ui.dropdown .menu .right.menu, + .ui.dropdown > .left.menu .menu, + .ui.floating.dropdown .menu, + .ui.floating.dropdown > .menu, + .ui.dropdown .right.menu > .menu, + .ui.secondary.vertical.menu > .item { + border-radius: ${otherThemeVars.border.radius} !important; + } +`; + +// 上半部分圆角替换 +export const radiusTop = css` + .ui.vertical.menu > .item, + .ui.vertical.menu > .active.item, + .ui.segments:not(.horizontal) > .segment { + &:first-child { + border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0; + } + } + + .ui.top.attached.header, + .ui.upward.dropdown > .menu, + .ui.upward.dropdown.button:not(.pointing):not(.floating).active, + .ui[class*="top attached"].menu, + .ui[class*="top attached"].segment, + .ui[class*="top attached"].segment:last-child, + .ui.search > .results > :first-child, + .ui.modal > i.icon:first-child + *, + .ui.modal > .dimmer:first-child + i.icon + *, + .ui.modal > .dimmer:first-child + *:not(.icon), + .ui.modal > :first-child:not(.icon):not(.dimmer), + .ui.table > thead > tr:first-child > th:only-child { + border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0; + } +`; + +// 上半部分圆角替换(原CSS带!important) +export const radiusTopImportant = css` + .ui.tabular.menu .active.item { + border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0 !important; + &:hover { + border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0 !important; + } + } + .ui.simple.upward.dropdown { + &.active { + border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0 !important; + } + &:hover { + border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0 !important; + } + } +`; + +// 下半部分圆角替换 +export const radiusBottom = css` + .ui.attached.segment, + .ui.vertical.menu > .item, + .ui.vertical.menu > .active.item, + .ui.segments:not(.horizontal) > .segment { + &:last-child { + border-radius: 0 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius}; + } + } + + .ui.modal, + .ui.search > .results { + > :last-child { + border-radius: 0 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius}; + } + } + + .ui.selection.dropdown, + .ui.menu .dropdown.item { + .menu { + border-radius: 0 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius}; + } + } + + .ui.table > tfoot > tr:first-child { + > th, + > td { + &:only-child { + border-radius: 0 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius}; + } + } + } + + .ui.bottom.attached.header, + .ui[class*="bottom attached"].table, + .ui.segment[class*="bottom attached"], + .ui.attached.segment:has(+ .ui.modal), + .ui.attached.segment:has(+ .page.buttons), + .ui.attached.segment:has(+ .ui[class*="top attached"].header), + .ui.segment:has(+ .ui.segment:not(.attached)) { + border-radius: 0 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius}; + } +`; + +// 下半部分圆角替换(原CSS带!important) +export const radiusBottomImportant = css` + .ui.upward.selection.dropdown.visible, + .ui.active.upward.selection.dropdown { + border-radius: 0 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} !important; + } +`; + +// 左半部分圆角替换 +export const radiusLeft = css` + .ui.menu > .item, + .ui.action.input > .button, + .ui.action.input > .dropdown, + .ui.horizontal.segments > .segment { + &:first-child { + border-radius: ${otherThemeVars.border.radius} 0 0 ${otherThemeVars.border.radius}; + } + } + + .ui[class*="left icon"].input > i.icon, + .ui.action.input > .buttons:first-child > .button { + border-radius: ${otherThemeVars.border.radius} 0 0 ${otherThemeVars.border.radius}; + } +`; + +// 右半部分圆角替换 +export const radiusRight = css` + .ui.compact.menu .item, + .ui.compact.menu:not(.secondary) .item, + .ui.pagination.menu .item, + .ui.action.input > .button, + .ui.action.input > .dropdown, + .ui.horizontal.segments > .segment { + &:last-child { + border-radius: 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0; + } + } + + .ui.icon.input > i.icon, + .ui.buttons .unescape-button, + .ui.action.input > .buttons:last-child > .button { + border-radius: 0 ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0; + } +`; + +// 左上圆角替换 +export const radiusTopLeft = css` + .ui.top.attached.menu > .item:first-child, + .ui.table > thead > tr:first-child > th:first-child { + border-top-left-radius: ${otherThemeVars.border.radius}; + } +`; + +// 右上圆角替换 +export const radiusTopRight = css` + .ui.table > thead > tr:first-child > th:last-child, + .ui.category.search > .results .category:first-child .name + .result { + border-top-right-radius: ${otherThemeVars.border.radius}; + } +`; + +// 左下圆角替换 +export const radiusBottomLeft = css` + .ui.table > tfoot > tr:first-child { + > th, + > td { + &:first-child { + border-bottom-left-radius: ${otherThemeVars.border.radius}; + } + } + } +`; + +// 右下圆角替换 +export const radiusBottomRight = css` + .ui.table > tfoot > tr:first-child { + > th, + > td { + &:last-child { + border-bottom-right-radius: ${otherThemeVars.border.radius}; + } + } + } + + .ui.category.search > .results .category:last-child .result:last-child { + border-bottom-right-radius: ${otherThemeVars.border.radius}; + } +`;