ant-design/.dumi/theme/slots/Header/Logo.tsx
afc163 59ad48476b
refactor: add boime lint and fix lint errrors (#49536)
* chore: add boime lint

* fix lint

* use files ignore

* revert change

* ignore clarity.js

* fix some errors

* fix some errors

* fix some errors

* fix some errors

* add yml file

* Update clarity.js

Signed-off-by: afc163 <afc163@gmail.com>

* add npm run lint:biome

* add npm run lint:biome

* fix test case

* fix ts errors

* fix ts errors

* fix lint and add .lintstagedrc

* shorten prop name

* chore: update package.json

* update biome.json

* chore: remove stylelint

* chore: useOptionalChain

* fix lint

* biome format

* prettier all code

* prettier all code

* fix site test

---------

Signed-off-by: afc163 <afc163@gmail.com>
2024-06-22 21:59:12 +08:00

72 lines
1.7 KiB
TypeScript

import * as React from 'react';
import { createStyles } from 'antd-style';
import { useLocation } from 'dumi';
import Link from '../../common/Link';
import * as utils from '../../utils';
const useStyle = createStyles(({ token, css }) => {
const { headerHeight, colorTextHeading, fontFamily, mobileMaxWidth } = token;
return {
logo: css`
height: ${headerHeight}px;
padding-inline-start: 40px;
overflow: hidden;
color: ${colorTextHeading};
font-weight: bold;
font-size: 18px;
font-family: AlibabaPuHuiTi, ${fontFamily}, sans-serif;
line-height: ${headerHeight}px;
letter-spacing: -0.18px;
white-space: nowrap;
text-decoration: none;
display: inline-flex;
align-items: center;
&:hover {
color: ${colorTextHeading};
}
img {
height: 32px;
vertical-align: middle;
margin-inline-end: ${token.marginSM}px;
}
@media only screen and (max-width: ${mobileMaxWidth}px) {
padding-inline-start: 0;
padding-inline-end: 0;
}
`,
title: css`
line-height: 32px;
`,
};
});
export interface LogoProps {
isZhCN: boolean;
location: any;
}
const Logo: React.FC<LogoProps> = ({ isZhCN }) => {
const { search } = useLocation();
const { styles } = useStyle();
return (
<h1>
<Link to={utils.getLocalizedPathname('/', isZhCN, search)} className={styles.logo}>
<img
src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
height={32}
width={32}
alt="logo"
/>
<span className={styles.title}>Ant Design</span>
</Link>
</h1>
);
};
export default Logo;