Skip to content

Commit

Permalink
feat(select): add font-weight theme variable (#6420)
Browse files Browse the repository at this point in the history
Co-authored-by: 07akioni <07akioni2@gmail.com>
  • Loading branch information
jahnli and 07akioni authored Oct 7, 2024
1 parent 57f4504 commit 28c7ec6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- `n-image` adds `error` slot, closes [#5649](https://github.com/tusen-ai/naive-ui/issues/5649)
- `n-date-picker` adds `date-format` prop.
- `n-progress`'s `color` prop supports gradient config.
- `n-select` adds `font-weight` theme variable


## 2.40.1

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- `n-image` 新增 `error` 插槽,关闭 [#5649](https://github.com/tusen-ai/naive-ui/issues/5649)
- `n-date-picker` 新增 `date-format` 属性
- `n-progress``color` 属性支持渐变色配置
- `n-select` 新增 `font-weight` 主题变量

## 2.40.1

Expand Down
9 changes: 7 additions & 2 deletions src/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,12 @@ export default defineComponent({
}
const cssVarsRef = computed(() => {
const {
common: { fontWeight },
self: { menuBoxShadow }
} = themeRef.value
return {
'--n-menu-box-shadow': menuBoxShadow
'--n-menu-box-shadow': menuBoxShadow,
'--n-font-weight': fontWeight
}
})
const themeClassHandle = inlineThemeDisabled
Expand Down Expand Up @@ -932,7 +934,10 @@ export default defineComponent({
},
render() {
return (
<div class={`${this.mergedClsPrefix}-select`}>
<div
class={`${this.mergedClsPrefix}-select`}
style={{ '--n-font-weight': this.cssVars?.['--n-font-weight'] }}
>
<VBinder>
{{
default: () => [
Expand Down
1 change: 1 addition & 0 deletions src/select/src/styles/index.cssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default c([
outline: none;
width: 100%;
position: relative;
font-weight: var(--n-font-weight);
`),
cB('select-menu', `
margin: 4px 0;
Expand Down

0 comments on commit 28c7ec6

Please sign in to comment.