Chap05 -> Implementing links -> Using the Link component

master
Jason Zhu 2022-03-29 16:22:23 +11:00
parent 353cb61006
commit 89ea270218
1 changed files with 9 additions and 8 deletions

View File

@ -1,9 +1,10 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import { fontFamily, fontSize, gray1, gray2, gray5 } from './Styles';
import React from 'react';
import { Link } from 'react-router-dom';
import { UserIcon } from './Icons';
import { fontFamily, fontSize, gray1, gray2, gray5 } from './Styles';
export const Header = () => {
const handleSearchInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
@ -26,8 +27,8 @@ export const Header = () => {
box-shadow: 0 3px 7px 0 rgba(100, 112, 114, 0.21);
`}
>
<a
href="./"
<Link
to="/"
css={css`
font-size: 24px;
font-weight: bold;
@ -36,7 +37,7 @@ export const Header = () => {
`}
>
Q & A
</a>
</Link>
<input
type="text"
placeholder="Search ..."
@ -57,8 +58,8 @@ export const Header = () => {
}
`}
/>
<a
href="./signin"
<Link
to="signin"
css={css`
font-family: ${fontFamily};
font-size: ${fontSize};
@ -83,7 +84,7 @@ export const Header = () => {
>
Sign In
</span>
</a>
</Link>
</div>
);
};