-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from syfxlin/develop
style(header): Refactor index button
- Loading branch information
Showing
4 changed files
with
35 additions
and
28 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use client"; | ||
import React, { ReactNode } from "react"; | ||
import { usePathname } from "next/navigation"; | ||
import { LinkButton } from "../../ui/button"; | ||
import { resolve } from "../../../utils/vender"; | ||
import { t } from "../../../locales"; | ||
import * as styles from "./styles.css"; | ||
|
||
export interface HomeProps { | ||
home: ReactNode; | ||
blog: ReactNode; | ||
} | ||
|
||
export const Home: React.FC<HomeProps> = ({ home, blog }) => { | ||
const path = usePathname(); | ||
if (path !== "/") { | ||
return ( | ||
<LinkButton tooltip aria-label={t("header.home")} href="/" className={styles.view_elastic}> | ||
<span>{t("header.home")}</span> | ||
{home} | ||
</LinkButton> | ||
); | ||
} else { | ||
return ( | ||
<LinkButton tooltip aria-label={t("header.blog")} href={resolve("page", 1)} className={styles.view_elastic}> | ||
<span>{t("header.blog")}</span> | ||
{blog} | ||
</LinkButton> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters