mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 20:19:15 +00:00
feat(ci): 🎨 relases script
This commit is contained in:
@@ -1,74 +1,77 @@
|
||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
||||
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city';
|
||||
import styles from './breadcrumbs.css?inline';
|
||||
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city'
|
||||
import styles from './breadcrumbs.css?inline'
|
||||
|
||||
export const Breadcrumbs = component$(() => {
|
||||
useStyles$(styles);
|
||||
useStyles$(styles)
|
||||
|
||||
const { menu } = useContent();
|
||||
const loc = useLocation();
|
||||
const { menu } = useContent()
|
||||
const loc = useLocation()
|
||||
|
||||
const breadcrumbs = createBreadcrumbs(menu, loc.pathname);
|
||||
if (breadcrumbs.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<nav class="breadcrumbs">
|
||||
{breadcrumbs.map((b) => (
|
||||
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
});
|
||||
|
||||
export function createBreadcrumbs(menu: ContentMenu | undefined, pathname: string) {
|
||||
if (menu?.items) {
|
||||
for (const indexA of menu.items) {
|
||||
const breadcrumbA: ContentBreadcrumb = {
|
||||
text: indexA.text,
|
||||
};
|
||||
if (typeof indexA.href === 'string') {
|
||||
breadcrumbA.href = indexA.href;
|
||||
}
|
||||
if (indexA.href === pathname) {
|
||||
return [breadcrumbA];
|
||||
}
|
||||
|
||||
if (indexA.items) {
|
||||
for (const indexB of indexA.items) {
|
||||
const breadcrumbB: ContentBreadcrumb = {
|
||||
text: indexB.text,
|
||||
};
|
||||
if (typeof indexB.href === 'string') {
|
||||
breadcrumbB.href = indexB.href;
|
||||
}
|
||||
if (indexB.href === pathname) {
|
||||
return [breadcrumbA, breadcrumbB];
|
||||
}
|
||||
|
||||
if (indexB.items) {
|
||||
for (const indexC of indexB.items) {
|
||||
const breadcrumbC: ContentBreadcrumb = {
|
||||
text: indexC.text,
|
||||
};
|
||||
if (typeof indexC.href === 'string') {
|
||||
breadcrumbC.href = indexC.href;
|
||||
}
|
||||
if (indexC.href === pathname) {
|
||||
return [breadcrumbA, breadcrumbB, breadcrumbC];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const breadcrumbs = createBreadcrumbs(menu, loc.pathname)
|
||||
if (breadcrumbs.length === 0) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
return (
|
||||
<nav class="breadcrumbs">
|
||||
{breadcrumbs.map((b) => (
|
||||
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
||||
))}
|
||||
</nav>
|
||||
)
|
||||
})
|
||||
|
||||
export function createBreadcrumbs(
|
||||
menu: ContentMenu | undefined,
|
||||
pathname: string
|
||||
) {
|
||||
if (menu?.items) {
|
||||
for (const indexA of menu.items) {
|
||||
const breadcrumbA: ContentBreadcrumb = {
|
||||
text: indexA.text,
|
||||
}
|
||||
if (typeof indexA.href === 'string') {
|
||||
breadcrumbA.href = indexA.href
|
||||
}
|
||||
if (indexA.href === pathname) {
|
||||
return [breadcrumbA]
|
||||
}
|
||||
|
||||
if (indexA.items) {
|
||||
for (const indexB of indexA.items) {
|
||||
const breadcrumbB: ContentBreadcrumb = {
|
||||
text: indexB.text,
|
||||
}
|
||||
if (typeof indexB.href === 'string') {
|
||||
breadcrumbB.href = indexB.href
|
||||
}
|
||||
if (indexB.href === pathname) {
|
||||
return [breadcrumbA, breadcrumbB]
|
||||
}
|
||||
|
||||
if (indexB.items) {
|
||||
for (const indexC of indexB.items) {
|
||||
const breadcrumbC: ContentBreadcrumb = {
|
||||
text: indexC.text,
|
||||
}
|
||||
if (typeof indexC.href === 'string') {
|
||||
breadcrumbC.href = indexC.href
|
||||
}
|
||||
if (indexC.href === pathname) {
|
||||
return [breadcrumbA, breadcrumbB, breadcrumbC]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
interface ContentBreadcrumb {
|
||||
text: string;
|
||||
href?: string;
|
||||
text: string
|
||||
href?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user