Skip to content

Commit db16d52

Browse files
committed
style: move logo on homepage into its own component and fix missing height property
missing height property would cause content shifting after the logo loaded.
1 parent 7e555e7 commit db16d52

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/components/Logo/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @ts-ignore
2+
import LogoImageUrl from '@site/static/img/logo.png';
3+
4+
export default function Logo() {
5+
const logoSize: number = 128;
6+
7+
return (
8+
<div className="image-container">
9+
<img src={LogoImageUrl} alt="CRC Logo" style={{
10+
height: logoSize,
11+
width: logoSize,
12+
// backgroundImage: "linear-gradient(-45deg, rgb(189, 52, 254) 50%, rgb(255, 54, 112) 50%)"
13+
}}/>
14+
</div>
15+
)
16+
}

src/pages/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import Layout from '@theme/Layout';
55
import Heading from '@theme/Heading';
66

77
import styles from './index.module.css';
8+
import Logo from "@site/src/components/Logo";
89

910
function HomepageHeader() {
1011
const {siteConfig} = useDocusaurusContext();
1112
return (
1213
<header className={clsx('hero hero--primary', styles.heroBanner)}>
1314
<div className="container">
14-
<img src={require('@site/static/img/logo.png').default} alt="CRC Logo" style={{width: 128}}/>
15+
<Logo/>
1516
<Heading as="h1" className="hero__title">
1617
{siteConfig.title}
1718
</Heading>

0 commit comments

Comments
 (0)