// Themes
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar theme="primary"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar theme="secondary"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar theme="tertiary"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar theme="quaternary"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
// Variants
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar variant="solid"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar variant="outline"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar variant="glass"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
// Rounding
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar rounding="none"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar rounding="medium"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar rounding="large"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
// Shadows
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar shadow="none"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar shadow="light"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>
const items = [
{ icon: <FaHome />, label: "Home", path: "/" },
{ icon: <FaCompactDisc />, label: "Music", path: "/music" },
{ icon: <FaImage />, label: "Images", path: "/photography" },
{ icon: <FaCode />, label: "Code", path: "/code" },
{ icon: <FaCommentAlt />, label: "Blog", path: "/blog" },
{ icon: <FaPaintBrush />, label: "Design", path: "/design" }
];
const currentPath = "/code/project-one";
const normalizePath = (p: string) =>
p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
const isItemActive = (item) => {
const itemPath = normalizePath(item.path);
const activePath = normalizePath(currentPath);
if (itemPath === "/") {
return activePath === "/";
}
return activePath === itemPath || activePath.startsWith(`${itemPath}/`);
};
<Navbar shadow="strong"
items={items}
isItemActive={isItemActive}
theme="primary"
rounding="full"
shadow="light"
/>