Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[组件-清爽首页] feat: 为栏目主标题字体颜色添加浅色样式 #4412

Merged
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
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
Loading