You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

67 lines
1.6 KiB

import { css } from '@emotion/react';
import { Link, useLocation } from 'dumi';
import * as React from 'react';
import useSiteToken from '../../../hooks/useSiteToken';
import * as utils from '../../utils';
const useStyle = () => {
const { token } = useSiteToken();
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: 12px;
}
@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 { logo, title } = useStyle();
return (
<h1>
<Link to={utils.getLocalizedPathname('/', isZhCN, search)} css={logo}>
<img src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" alt="logo" />
<span css={title}>Ant Design</span>
</Link>
</h1>
);
};
export default Logo;