Chap03 -> Creating function-based component -> Adding elements to the Header component

This commit is contained in:
Jason Zhu 2022-03-23 23:13:58 +11:00
parent 95cb876ef5
commit b11004925a
3 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,13 @@
import React from 'react';
import { UserIcon } from './Icons';
export const Header = () => <div>header</div>;
export const Header = () => (
<div>
<a href="./">Q & A</a>
<input type="text" placeholder="Search ..." />
<a href="./signin">
<UserIcon />
<span>Sign In</span>
</a>
</div>
);

View File

@ -0,0 +1,3 @@
import React from 'react';
import user from './user.svg';
export const UserIcon = () => <img src={user} alt="User" width="12px" />;

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20px">
<path d="M5 5a5 5 0 0 1 10 0v2A5 5 0 0 1 5 7V5zM0 16.68A19.9 19.9 0 0 1 10 14c3.64 0 7.06.97 10 2.68V20H0v-3.32z"/>
</svg>

After

Width:  |  Height:  |  Size: 199 B