Skip to content

Commit

Permalink
Merge pull request #255 from oceanbase/dengfuping-dev
Browse files Browse the repository at this point in the history
fix(ui): BasicLayout locale switch font size is too large
  • Loading branch information
dengfuping authored Oct 31, 2023
2 parents b3cbeca + af597c7 commit 1acc573
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
12 changes: 6 additions & 6 deletions packages/ui/src/BasicLayout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ const Header: React.FC<HeaderProps> = ({
)}

{showLocale && (
<span className={`${prefixCls}-extra-item`}>
<LocaleDropdown locales={locales || langs} />
</span>
<LocaleDropdown locales={locales || langs} className={`${prefixCls}-extra-item`} />
)}

{userMenu ? (
Expand Down Expand Up @@ -223,9 +221,11 @@ const Header: React.FC<HeaderProps> = ({
)}

{showLocale && (
<span className={`${prefixCls}-extra-item`}>
<LocaleDropdown showLabel={true} locales={locales || langs} />
</span>
<LocaleDropdown
showLabel={true}
locales={locales || langs}
className={`${prefixCls}-extra-item`}
/>
)}

{userMenu ? (
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/BasicLayout/style/Header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { genComponentStyleHook } from '../../_util/genComponentStyleHook';
export type HeaderToken = FullToken<any>;

export const genHeaderStyle: GenerateStyle<HeaderToken> = (token: HeaderToken): CSSObject => {
const { antCls, componentCls } = token;
const { componentCls } = token;

return {
[`${componentCls}`]: {
Expand Down
13 changes: 8 additions & 5 deletions packages/ui/src/LocaleDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ import type { DropdownProps } from '@oceanbase/design/es/dropdown';
import React from 'react';
import { LOCALE_LIST } from '../constant';
import type { Locale } from '../interface';
import { getLocale, getPrefix, setLocale } from '../_util';
import { getLocale, setLocale } from '../_util';

export interface LocaleDropdownProps extends DropdownProps {
// 自定义语言列表
locales?: Locale[];
showLabel?: boolean;
}

const prefix = getPrefix('layout-header');

const LocaleDropdown: React.FC<LocaleDropdownProps> = ({ locales, showLabel, ...restProps }) => {
const LocaleDropdown: React.FC<LocaleDropdownProps> = ({
locales,
showLabel,
className,
...restProps
}) => {
// 语言切换菜单
const localeMenu = (
<Menu
Expand Down Expand Up @@ -47,7 +50,7 @@ const LocaleDropdown: React.FC<LocaleDropdownProps> = ({ locales, showLabel, ...
{findByValue(LOCALE_LIST, getLocale()).minLabel}
</span>
) : (
<Space className={`${prefix}-extra-item`}>
<Space className={className}>
<GlobalOutlined />
{findByValue(LOCALE_LIST, getLocale()).shortLabel}
</Space>
Expand Down
6 changes: 1 addition & 5 deletions packages/ui/src/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,7 @@ const Login: React.FC<LoginProps> = props => {
</div>
</div>
<div className={`${prefix}-card`}>
{showLocale && (
<span className={`${prefix}-locale`}>
<LocaleDropdown locales={locales} />
</span>
)}
{showLocale && <LocaleDropdown locales={locales} className={`${prefix}-locale`} />}
{board && <div className={`${prefix}-board`}>{board}</div>}
<div className={`${prefix}-content`}>
{showActivate ? (
Expand Down

0 comments on commit 1acc573

Please sign in to comment.