-
Notifications
You must be signed in to change notification settings - Fork 0
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 #5 from qld-gov-au/QOLOE-530-Breadcrumbs
Breadcrumbs init setup
- Loading branch information
Showing
5 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
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,62 @@ | ||
/** | ||
* Blockquote component | ||
* Common js module to support DXP Component Service. | ||
*/ | ||
module.exports = async function (input, info) { | ||
const getBreadcrumbData = function () { | ||
let breadcrumbHtml = ""; | ||
const navData = [ | ||
{ | ||
link: "#", | ||
linktext: "Home", | ||
}, | ||
{ | ||
link: "#", | ||
linktext: "Topic 01", | ||
}, | ||
{ | ||
link: "#", | ||
linktext: "Topic 02", | ||
}, | ||
{ | ||
link: "#", | ||
linktext: "Topic 03", | ||
}, | ||
{ | ||
link: "#", | ||
linktext: "Current page", | ||
}, | ||
]; | ||
const breadcrumbLength = Number(navData.length); | ||
|
||
for (const navItems in navData) { | ||
if (Number(navItems) + 1 < breadcrumbLength) { | ||
breadcrumbHtml += `<li class="breadcrumb-item"> | ||
<a href="${navData[navItems].link}"> | ||
${navData[navItems].linktext} | ||
</a> | ||
</li>`; | ||
} else { | ||
breadcrumbHtml += `<li class="breadcrumb-item active" aria-current="page" data-href="${navData[navItems].link}"> | ||
${navData[navItems].linktext} | ||
</li>`; | ||
} | ||
} | ||
|
||
return breadcrumbHtml; | ||
}; | ||
return ` | ||
<div class="container-fluid ${input.colour}"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="container-xl"> | ||
<nav aria-label="breadcrumb"> | ||
<ol class="breadcrumb"> | ||
${getBreadcrumbData()} | ||
</ol> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</div>`; | ||
}; |
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,75 @@ | ||
{ | ||
"$schema": "http://localhost:3000/schemas/v1.json#", | ||
"version": "1.0.1", | ||
"name": "breadcrumbs", | ||
"displayName": "Breadcrumbs Component", | ||
"description": "QGDS Bootstrap 5 - Breadcrumbs Component", | ||
"namespace": "qgds-bs5-local", | ||
"mainFunction": "main", | ||
"staticFiles": { | ||
"locationRoot": "static" | ||
}, | ||
"functions": [ | ||
{ | ||
"name": "main", | ||
"entry": "main.cjs", | ||
"input": { | ||
"type": "object", | ||
"properties": { | ||
"colour": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [] | ||
}, | ||
"output": { | ||
"responseType": "html", | ||
"staticFiles": [ | ||
{ | ||
"location": "header", | ||
"file": { | ||
"type": "css", | ||
"filepath": "https://static.qgov.net.au/qgds-bootstrap5/v1/v1.x.x-latest/assets/css/qld.bootstrap.css" | ||
} | ||
}, | ||
{ | ||
"location": "header", | ||
"file": { | ||
"type": "css", | ||
"filepath": "breadcrumb.css" | ||
} | ||
}, | ||
{ | ||
"location": "footer", | ||
"file": { | ||
"type": "js", | ||
"filepath": "https://static.qgov.net.au/qgds-bootstrap5/v1/v1.x.x-latest/assets/js/bootstrap.min.js" | ||
} | ||
}, | ||
{ | ||
"location": "footer", | ||
"file": { | ||
"type": "js", | ||
"filepath": "https://static.qgov.net.au/qgds-bootstrap5/v1/v1.x.x-latest/assets/js/qld.bootstrap.min.js" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"previews": { | ||
"default": { | ||
"functionData": { | ||
"main": { | ||
"inputData": { | ||
"type": "file", | ||
"path": "previews/example.data.json" | ||
}, | ||
"wrapper": { | ||
"path": "previews/preview.html" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,3 @@ | ||
{ | ||
"colour": " alt" | ||
} |
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,17 @@ | ||
<html> | ||
|
||
<head> | ||
[component://static-header] | ||
<!-- <link rel="stylesheet" | ||
href="https://www.forgov.qld.gov.au/__data/assets/git_bridge/0030/498603/assets/css/qld.bootstrap.css"> | ||
<link rel="stylesheet" | ||
href="https://www.forgov.qld.gov.au/__data/assets/css_file_folder/0029/499142/QGDS-forgov-shim.css"> --> | ||
|
||
</head> | ||
|
||
<body> | ||
[component://output] | ||
[component://static-footer] | ||
</body> | ||
|
||
</html> |
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,48 @@ | ||
.breadcrumb-item a:before { | ||
margin-block-start: 0.4rem; | ||
width: 1rem; | ||
content: var(--qld-breadcrumb-divider-flipped); | ||
float: right; | ||
padding-left: var(--qld-breadcrumb-item-padding-x); | ||
} | ||
.breadcrumb-item a:after { | ||
content: "" !important; | ||
content: none !important; | ||
} | ||
.breadcrumb { | ||
--qld-breadcrumb-padding-y: 2rem; | ||
} | ||
.breadcrumb-item { | ||
line-height: var(--qld-body-line-height); | ||
} | ||
|
||
@media (max-width: 699px) { | ||
.breadcrumb-item:before { | ||
margin-block-start: 0.4rem; | ||
} | ||
.breadcrumb-item a:before { | ||
content: "" !important; | ||
content: none !important; | ||
} | ||
} | ||
@media (min-width: 700px) { | ||
.breadcrumb-item { | ||
display: none; | ||
&:before { | ||
content: "" !important; | ||
content: none !important; | ||
} | ||
} | ||
.breadcrumb-item:nth-last-child(2) { | ||
display: list-item; | ||
} | ||
.breadcrumb-item:last-child { | ||
display: list-item; | ||
} | ||
} | ||
|
||
@media (min-width: 992px) { | ||
.breadcrumb-item { | ||
display: list-item; | ||
} | ||
} |