0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

google clone Part9 22 検索結果ヘッダーのアイコン、ボタン類を実装

Last updated at Posted at 2023-05-18

概要

目次

今回は検索後画面のヘッダーの一部を実装します。
左端にgoogleの画像、右端にアイコン・ボタン類を実装します。
以下画像は実装後の画面です。
dadasdsdsdsa.gif

開発環境

OS:Windows10
IDE:VSCode

"@next/font": "13.1.5",
"autoprefixer": "10.4.14",
"eslint": "8.39.0",
"eslint-config-next": "13.3.1",
"next": "13.3.1",
"postcss": "8.4.23",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.8.0",
"tailwindcss": "3.3.2"

実装のポイント

ディスプレイサイズ768pix以上

image.png

ディスプレイサイズ768以下

アイコン類にhiddenが効くので非表示になります。

image.png

コード部分

SearchHeader

SearchHeader.jsx
import Image from "next/image";
import Link from "next/link";
import SearchBox from "./SearchBox";
import { RiSettings3Line }  from "react-icons/ri";
import { TbGridDots } from "react-icons/tb";
import SearchHeaderOptions from "./SearchHeaderOptions";

export default function SearchHeader() {
  return (
+    <header className="sticky top-0 bg-white">
+        <div className="flex w-full p-6 items-center justify-between">
            <Link href={"/"}>
                <Image width="120" height="40" src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/640px-Google_2015_logo.svg.png"/>
            </Link>
            <div className="flex-1">
                <SearchBox />
            </div>

+            <div className="hidden md:inline-flex space-x-2">
                <RiSettings3Line className="header-icon" />
                <TbGridDots className="header-icon" />
            </div>

            <button className="bg-blue-500 text-white px-6 py-2 font-medium rounded-md hover:brightness-105 hover:shadow-md transition-all ml-2">
                Sign in
            </button>
        </div>
        <SearchHeaderOptions />
    </header>
  )
}

参考

css

Inline Flex

image.png

flex-1

image.png

その他

Udemy

githubコミット分

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?