diff --git a/blocks/breadcrumbs/breadcrumbs.css b/blocks/breadcrumbs/breadcrumbs.css new file mode 100644 index 00000000..0aeea7f5 --- /dev/null +++ b/blocks/breadcrumbs/breadcrumbs.css @@ -0,0 +1,24 @@ +raqn-breadcrumbs { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 10px; + align-items: center; + padding: 10px 0; + + ul { + list-style: none; + padding: 0; + margin: 0; + display: flex; + + li { + margin-inline-end: 1em; + font-weight: bold; + + a { + color: var(--scope-color); + font-weight: normal; + } + } + } +} diff --git a/blocks/breadcrumbs/breadcrumbs.js b/blocks/breadcrumbs/breadcrumbs.js new file mode 100644 index 00000000..d4666e49 --- /dev/null +++ b/blocks/breadcrumbs/breadcrumbs.js @@ -0,0 +1,30 @@ +import ComponentBase from '../../scripts/component-base.js'; + +export default class BreadCrumbs extends ComponentBase { + capitalize(string) { + return string + .split('-') + .map((str) => str.charAt(0).toUpperCase() + str.slice(1)) + .join(' '); + } + + ready() { + this.path = window.location.pathname.split('/'); + this.classList.add('breadcrumbs'); + this.innerHTML = ` +