Skip to content

Commit

Permalink
Merge pull request #4412 from Tinhone/fresh-home-column-font-new-color
Browse files Browse the repository at this point in the history
[组件-清爽首页] feat: 为栏目主标题字体颜色添加浅色样式
  • Loading branch information
the1812 authored Sep 14, 2023
2 parents 7ba1ef3 + c0bb391 commit a01afc2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { addComponentListener } from '@/core/settings'

export enum areaPrimaryTitleColorEnum {
Dark = '深色',
Light = '浅色',
}

const map = {
[areaPrimaryTitleColorEnum.Dark]: 'dark',
[areaPrimaryTitleColorEnum.Light]: 'light',
}

addComponentListener(
'freshHome.areaPrimaryTitleColor',
(value: areaPrimaryTitleColorEnum) => {
document.documentElement.setAttribute(
'fresh-home--options--area-primary-title-color',
map[value],
)
},
true,
)
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ export default Vue.extend({
bottom: 8px;
font-size: 18px;
@include semi-bold();
color: black;
transition: color 0.2s ease-out, text-shadow 0.2s ease-out;
html[fresh-home--options--area-primary-title-color='dark'] & {
color: black;
}
html[fresh-home--options--area-primary-title-color='light'] & {
color: #fafafa;
text-shadow: rgba(0, 0, 0, 0.2) 0 0 8px;
}
}
}
&-other {
Expand Down
6 changes: 6 additions & 0 deletions registry/lib/components/style/home-redesign/fresh/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineOptionsMetadata } from '@/components/define'
import { getNumberValidator } from '@/core/utils'
import type { FreshLayoutItemSettings } from './layouts/fresh-layout-item'
import { areaPrimaryTitleColorEnum } from './init-dropdown-options/area-primary-title-color'

export enum RankListMode {
Default = 'default',
Expand Down Expand Up @@ -48,6 +49,11 @@ export const freshHomeOptionsMetadata = defineOptionsMetadata({
displayName: '启用横向滚动',
defaultValue: false,
},
areaPrimaryTitleColor: {
displayName: '栏目主标题颜色',
dropdownEnum: areaPrimaryTitleColorEnum,
defaultValue: areaPrimaryTitleColorEnum.Dark,
},
maxWidth: {
displayName: '最大宽度 (px)',
defaultValue: 1440,
Expand Down

0 comments on commit a01afc2

Please sign in to comment.