fix(frontend): 侧边栏滚动失效与 Jenkins 图标本地化
- ScrollArea 增加 min-h-0,修复 flex 子项不收缩导致导航超屏无法滚动 - Jenkins 品牌图标替换 simple-icons 单色红为仓库本地官方多色 SVG
This commit is contained in:
1 parent
e0cc547c8b
commit
5cd7ea4a39
3 files changed
+24
-5
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill="#d33833" d="M108.893 61.68c0 25.36-20.099 45.918-44.892 45.918-24.794 0-44.893-20.558-44.893-45.918s20.1-45.92 44.893-45.92 44.892 20.56 44.892 45.92"/><path fill="#ef3d3a" d="M20.938 73.052S17.688 25.167 61.81 23.8l-3.078-5.13-23.943 8.037-6.84 7.867-5.986 11.459-3.42 13.339 1.025 8.893"/><path fill="#231f20" d="M33.253 30.355c-7.876 8.06-12.75 19.186-12.75 31.496 0 12.307 4.874 23.436 12.75 31.494 7.88 8.057 18.74 13.03 30.747 13.03 12.007 0 22.867-4.973 30.747-13.03 7.876-8.058 12.751-19.187 12.751-31.494 0-12.31-4.875-23.437-12.751-31.496C86.867 22.3 76.007 17.327 64 17.326c-12.006.001-22.867 4.973-30.747 13.03zM31.26 95.294c-8.37-8.561-13.546-20.392-13.546-33.443 0-13.053 5.176-24.883 13.546-33.444 8.37-8.563 19.954-13.87 32.74-13.869 12.788-.002 24.374 5.306 32.741 13.869 8.372 8.561 13.548 20.392 13.547 33.444 0 13.05-5.175 24.882-13.547 33.443-8.367 8.562-19.953 13.87-32.74 13.87-12.787 0-24.372-5.308-32.74-13.87"/><path fill="#f0d6b7" d="m82.898 61.934-6.841 1.026-9.235 1.026-5.986.171-5.815-.17-4.446-1.369-3.934-4.275-3.078-8.722-.684-1.881-4.105-1.368-2.394-3.934-1.71-5.644 1.881-4.96 4.446-1.538 3.592 1.71 1.71 3.762 2.053-.342.683-.855-.683-3.933-.172-4.96 1.026-6.84-.04-3.908 3.119-4.985 5.472-3.934 9.578-4.104 10.603 1.539 9.235 6.67 4.276 6.84 2.736 4.96.684 12.313-2.053 10.604-3.762 9.405-3.591 4.96"/><path fill="#335061" d="m88.027 56.975-4.103 4.105v15.904l-3.58 14.66-1.721.047 1.367 16.418 6.498-.855L84.95 91.52l-2.902.079 7.863-.422s3.932-9.919 3.932-10.432c0-.513 3.422-14.365 3.422-14.365l-7.698-8.037-1.539-1.37zm-41.215 2.564-4.275 1.711-13.682 9.406.856 2.737 3.934 11.628 1.709 19.327 1.197 2.05 17.101 5.817 1.028-1.2-2.053-14.365v-4.103l24.455-1.027 1.88-1.026-14.876-7.012 2.736-5.3-3.933 1.367-1.54-1.881-2.052-8.893-1.711-.513-3.762-1.198-3.25-2.906-3.761-4.619z"/><path fill="#6d6b6d" d="m36.551 31.835 4.446-1.54 3.592 1.711 1.71 3.762 2.053-.342.513-2.052-1.026-3.933 1.026-9.407-.856-5.13 3.079-3.592 6.67-5.301-1.882-2.565-9.406 4.617-3.933 3.079-2.224 4.788-3.42 4.617-1.026 5.473.684 5.815"/><path fill="#dcd9d8" d="M59.445 4.021c-1.172-.012-2.543.108-2.543.108L45.787 8.406l-4.277 4.276-1.881 3.42 3.934-.342s2.565-6.328 12.826-9.406c6.413-1.924 5.01-2.312 3.056-2.333zM48.01 14.904l-9.406 2.223-2.737 8.893.684 5.814 1.88-1.195s-3.591-11.974 10.09-13.684l-.511-2.05z"/><path fill="#f7e4cd" d="M69.986.475a11.318 11.318 0 0 0-3.85.748c-10.26 3.933-17.785 11.115-17.615 15.732.292 7.864.172 7.87.172 7.87S51.601 9.774 66.31 6.866c12.108-2.393 18.468.512 20.863 3.248 0 0-8.25-9.82-17.186-9.64zm18.328 11.35c-.545-.003-4.913.108-5.074 4.277 0 0 0 .683.342 1.367 0 0 3.934-4.447 6.328-2.053l-1.539-3.59s-.02-.002-.057-.002zm-25.185 2.01c-.84.02-1.876.371-3.149 1.24-3.762 2.565-3.42 6.157-2.736 6.841.684.684.499 2.06 1.02 1.115.52-.945.349-4.022 2.23-4.877 1.881-.855 4.966-1.812 6.16-.222 0 0-.522-4.166-3.525-4.096zm26.437 10.476s-2.818.594-3.078 3.078c-.26 2.483 3.079.512 3.592.341l-.514-3.42zm-20.693.171s-3.762.513-3.762 2.907 4.276 2.223 5.473 1.197l-1.711-4.104zM38.432 30.64 34.5 34.742l.684 5.131 2.05 5.3 2.225.686c-3.25-3.933-1.711-6.671-1.027-10.433.683-3.763 7.183.172 7.183.172l-.172-2.567-2.564-2.05-4.447-.342zm38.609 7.847c-1.126-.05-1.556 3.635-1.648 4.586.31-.92 3.171-2.77 3.171-2.77s0-1.396-1.396-1.794a.549.549 0 0 0-.127-.022zm-1.648 4.586a.394.394 0 0 0-.02.221s.006-.08.02-.22zm-29.248 1.301-2.24 2.17.513 7.525 5.473 8.551s6.143 1.386 5.472.856c-7.353-5.815-7.866-16.59-8.037-17.788-.17-1.196-1.181-1.314-1.181-1.314zm19.244 2.549c-.675.01-1.122.228-1.248.396-.427.57.457 3.672.457 3.672l.855.172c-.17-3.421 1.881-3.764 1.881-3.764-.758-.364-1.42-.484-1.945-.476z"/><path fill="#49728b" d="m45.615 59.37-16.76 11.286 1.881 5.303 4.448 19.152.17 10.092 2.394.854c3.42-8.21-3.248-34.717-3.248-34.717l16.074-7.182-4.959-4.789zm6.614 19.448-.458 1.073s-.341 3.078-.341 3.933c0 .856.341 8.04.341 8.04h2.737V81.601l-2.28-2.784zm.056 14.584-7.695.342 2.222 1.54 5.473.855v-2.737zm35.742-36.427-3.248 3.591L96.75 69.46l.342-4.104-9.065-8.38zm-3.42 33.52-5.984 1.196.854 4.79c2.223 1.026 5.986-1.711 5.986-1.711l-.856-4.276z"/><path fill="#fff" d="M50.574 62.62v1.538l2.174 2.395 6.84 3.078.172-5.129-4.739-.516-4.447-1.367zm50.059 24.284-5.473 1.711-5.25 2.563-2.789-.51-2.172.853 1.832 14.368 6.668-1.883 12.656-.684 1.881-5.814-3.42-10.09-3.933-.514zm-22.01 4.787-9.97.002-16.026.854.291 7.869 1.762 10.6 3.54 14.369 7.866 1.709 12.998-1.026.17-2.566-1.54-13.852.909-17.959zm1.317-1.366-3.763-9.577-3.934-5.644s.855-2.394 2.053-2.394h3.933l3.762 1.368-.341 6.328-1.71 9.92"/><path fill="#dcd9d8" d="m52.115 65.014-.513.685 2.908 2.051 4.787 1.025-.17-2.05c-1.71.513-7.012-1.711-7.012-1.711zm23.77 7.353-3.932.512 6.67 15.734 1.367.172.684-1.71s-4.79-9.236-4.79-10.604c0 0 .856-2.052 2.053-1.54 1.198.514 3.764 1.882 3.764 1.882v-3.249l-5.816-1.197zm16.248 17.957-2.223.854 1.881 9.406c-.684-.171-5.13 1.883-5.13 1.883l.51 2.736 1.884-.685 5.9Line truncated
|
||||||
|
After Width: | Height: | Size: 15 KiB |
@@ -4,7 +4,6 @@ import {
|
|||||||
siDocker,
|
siDocker,
|
||||||
siElasticsearch,
|
siElasticsearch,
|
||||||
siGrafana,
|
siGrafana,
|
||||||
siJenkins,
|
|
||||||
siKubernetes,
|
siKubernetes,
|
||||||
siPrometheus,
|
siPrometheus,
|
||||||
} from 'simple-icons';
|
} from 'simple-icons';
|
||||||
@@ -13,12 +12,17 @@ const ICONS = {
|
|||||||
docker: siDocker,
|
docker: siDocker,
|
||||||
elasticsearch: siElasticsearch,
|
elasticsearch: siElasticsearch,
|
||||||
grafana: siGrafana,
|
grafana: siGrafana,
|
||||||
jenkins: siJenkins,
|
|
||||||
kubernetes: siKubernetes,
|
kubernetes: siKubernetes,
|
||||||
prometheus: siPrometheus,
|
prometheus: siPrometheus,
|
||||||
} satisfies Record<string, SimpleIcon>;
|
} satisfies Record<string, SimpleIcon>;
|
||||||
|
|
||||||
export type TechnologyBrand = keyof typeof ICONS;
|
// Jenkins 使用仓库本地官方多色 SVG(public/icons/jenkins.svg),
|
||||||
|
// 替换 simple-icons 的单色红色版本。 // Logan.Li
|
||||||
|
const LOCAL_SVG: Partial<Record<keyof typeof ICONS | 'jenkins', string>> = {
|
||||||
|
jenkins: '/icons/jenkins.svg',
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TechnologyBrand = keyof typeof ICONS | 'jenkins';
|
||||||
|
|
||||||
interface TechnologyBrandIconProps {
|
interface TechnologyBrandIconProps {
|
||||||
brand: TechnologyBrand;
|
brand: TechnologyBrand;
|
||||||
@@ -31,7 +35,20 @@ export function TechnologyBrandIcon({
|
|||||||
className = 'h-5 w-5',
|
className = 'h-5 w-5',
|
||||||
title,
|
title,
|
||||||
}: TechnologyBrandIconProps) {
|
}: TechnologyBrandIconProps) {
|
||||||
const icon = ICONS[brand];
|
const localSrc = LOCAL_SVG[brand];
|
||||||
|
if (localSrc) {
|
||||||
|
return (
|
||||||
|
<img
|
||||||
|
src={localSrc}
|
||||||
|
alt={title || 'Jenkins'}
|
||||||
|
aria-label={title}
|
||||||
|
role="img"
|
||||||
|
className={className}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const icon: SimpleIcon = ICONS[brand as keyof typeof ICONS];
|
||||||
const label = title || icon.title;
|
const label = title || icon.title;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -415,7 +415,8 @@ export function Sidebar({ mobileOpen, onMobileClose }: SidebarProps) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Menu Items */}
|
{/* Menu Items */}
|
||||||
<ScrollArea className="flex-1 py-2 px-1.5">
|
{/* min-h-0 允许 flex 子项收缩,否则导航超出高度时 ScrollArea 不会出现滚动 // Logan.Li */}
|
||||||
|
<ScrollArea className="flex-1 min-h-0 py-2 px-1.5">
|
||||||
<nav className="space-y-0.5">
|
<nav className="space-y-0.5">
|
||||||
{visibleMenuItems.map((item) => (
|
{visibleMenuItems.map((item) => (
|
||||||
<MenuItemComponent
|
<MenuItemComponent
|
||||||
|
|||||||
Reference in new issue
Block a user