@chakra-ui/react#Breadcrumb TypeScript Examples
The following examples show how to use
@chakra-ui/react#Breadcrumb.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Breadcrumbs.tsx From ke with MIT License | 6 votes |
Breadcrumbs = ({ rules }: { rules: TPathRules }): JSX.Element => {
const { pathname } = useLocation()
const [breadcrumbData, setBreadcrumbData] = useState(getBreadcrumbs(rules, pathname))
useEffect(() => {
setBreadcrumbData(getBreadcrumbs(rules, pathname))
}, [pathname, rules])
return (
<Breadcrumb separator="/">
{breadcrumbData.map((bd) => (
<BreadcrumbItem key={bd.title}>
<BreadcrumbLink
href={bd.href || '#'}
style={{
fontWeight: 'bold',
color: '#3072C4',
}}
>
{bd.title}
</BreadcrumbLink>
</BreadcrumbItem>
))}
</Breadcrumb>
)
}
Example #2
Source File: BreadcrumbPreview.tsx From openchakra with MIT License | 6 votes |
BreadcrumbPreview: React.FC<IPreviewProps> = ({ component }) => {
const acceptedTypes = ['BreadcrumbItem', 'BreadcrumbLink'] as ComponentType[]
const { props, ref } = useInteractive(component, false)
const { drop, isOver } = useDropComponent(component.id, acceptedTypes)
let boxProps: any = {}
if (isOver) {
props.bg = 'teal.50'
}
return (
<Box ref={drop(ref)} {...boxProps}>
<Breadcrumb {...props}>
{component.children.map((key: string) => (
<ComponentPreview key={key} componentName={key} />
))}
</Breadcrumb>
</Box>
)
}
Example #3
Source File: [slug].tsx From ksana.in with Apache License 2.0 | 5 votes |
export default function BlogDetail({ post }: IBlogDetail) {
return (
<Layout>
<MetaHead title={`${post.title} | Ksana.in`} description={post.excerpt} />
<Head>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(makeBreadcrumbBlogSchema({ title: post.title, slug: post.slug }))
}}
></script>
</Head>
<VStack spacing={4} textAlign="center" as="section" mt="32">
<Breadcrumb>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbItem>
<BreadcrumbLink href="/blog">Blog</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbItem isCurrentPage>
<BreadcrumbLink href={`/blog/${post.slug}`}>{post.title}</BreadcrumbLink>
</BreadcrumbItem>
</Breadcrumb>
<Container maxW={'4xl'} mx="auto" as="section" mt="8">
<VStack spacing={4} textAlign="center" className="blog-detail">
<Heading
as="h1"
fontWeight={700}
fontSize={{ base: '3xl', sm: '4xl', md: '5xl' }}
lineHeight={'110%'}
color="orange.400"
>
{post.title}
</Heading>
<Button leftIcon={<HiClock />} colorScheme="gray" variant="solid" size="xs">
{post.date}
</Button>
</VStack>
</Container>
</VStack>
<Container maxW={'4xl'} mx="auto" as="section" mt="8">
<div className="markdown">
<div
dangerouslySetInnerHTML={{
__html: `${post.content}`
}}
></div>
</div>
</Container>
</Layout>
)
}