-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(support-pages): Add a new import script #275
Changes from all commits
23bc6d4
1e186a6
256ca28
6d28bac
665647e
b3a7b33
c17632c
97d6e27
745a97c
5baa0f1
58287c0
304b486
2cafe5d
be96a86
f64fa28
877493f
7f47653
9f77f2b
28a166f
1c364de
ec7433d
7bd8139
0b60d17
678fb70
a5f826d
1cb298f
85d5c36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* Breadcrumb CSS */ | ||
|
||
.section.breadcrumb-container > div.breadcrumb-wrapper { | ||
padding: unset; | ||
width: 100%; | ||
background-color: #F3F1ED; | ||
} | ||
|
||
.breadcrumb.block { | ||
display: flex; | ||
flex-direction: row; | ||
margin: 0 auto; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
padding: 0 24px; | ||
} | ||
|
||
.breadcrumb.block .breadcrumb-links { | ||
padding: 19px 0 !important; | ||
font-family: var(--sans-serif-font-regular); | ||
font-size: var(--font-size-16); | ||
font-weight: var(--font-weight-regular); | ||
line-height: var(--line-height-160); | ||
letter-spacing: var(--letter-spacing-001-em); | ||
} | ||
|
||
.breadcrumb.block .breadcrumb-links span.breadcrumb-link { | ||
margin-right: 10px; | ||
} | ||
|
||
.breadcrumb.block .breadcrumb-links span.breadcrumb-link:not(.active) a { | ||
text-decoration: none; | ||
color: var(--neutral-carbon); | ||
} | ||
|
||
.breadcrumb.block .breadcrumb-links span.breadcrumb-link:hover, | ||
.breadcrumb.block .breadcrumb-links span.breadcrumb-link.active { | ||
color: var(--primary-purple); | ||
} | ||
|
||
.breadcrumb.block .breadcrumb-links span.breadcrumb-link:hover a, | ||
.breadcrumb.block .breadcrumb-links span.breadcrumb-link.active a { | ||
color: var(--primary-purple); | ||
text-decoration: underline; | ||
} | ||
|
||
@media only screen and (min-width: 1200px) { | ||
.breadcrumb.block { | ||
margin: 0 auto; | ||
padding: unset; | ||
width: var(--section-width-desktop); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { createTag } from '../../scripts/scripts.js'; | ||
|
||
export default async function decorate(block) { | ||
const breadcrumbLinks = createTag('div', { class: 'breadcrumb-links' }); | ||
const links = block.querySelectorAll('a'); | ||
links.forEach((link) => { | ||
link.parentElement.remove(); | ||
const newLink = createTag('span', { class: 'breadcrumb-link' }, link); | ||
const linkUrl = new URL(link.href); | ||
if (linkUrl.pathname === window.location.pathname) newLink.classList.add('active'); | ||
breadcrumbLinks.appendChild(newLink); | ||
newLink.innerHTML += ' > '; | ||
}); | ||
block.prepend(breadcrumbLinks); | ||
const icon = block.querySelector('span.icon'); | ||
icon.parentElement.parentElement.remove(); | ||
block.append(icon); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Right Nav CSS */ | ||
|
||
@media only screen and (min-width: 1200px) { | ||
main .section.right-nav-container > div { | ||
width: unset; | ||
} | ||
|
||
.section.right-nav-container { | ||
position: relative; | ||
display: grid; | ||
grid-template-columns: 3fr 1fr; | ||
width: var(--section-width-desktop); | ||
margin: 0 auto; | ||
} | ||
|
||
.section.right-nav-container > *:not(.right-nav-wrapper) { | ||
grid-column-start: 1; | ||
} | ||
|
||
.section.right-nav-container > .right-nav-wrapper { | ||
grid-column-start: 2; | ||
grid-row-start: 1; | ||
padding-top: var(--spacer-layout-07); | ||
margin-left: 8%; | ||
} | ||
} | ||
Comment on lines
+1
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpicking: I think we should rename this block There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. feel free to change the name. whatever makes more sense for you |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* Search Block CSS */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: We'll clean up some of the stylings to ensure that we're using the spacings and etc from the design specs. |
||
.search.block { | ||
width: 100%; | ||
font-family: var(--sans-serif-font-light); | ||
font-size: var(--font-size-16); | ||
letter-spacing: var(--letter-spacing-001-em); | ||
line-height: var(--line-height-160); | ||
font-weight: var(--font-weight-light); | ||
color: var(--neutral-carbon); | ||
} | ||
|
||
.search.block form { | ||
position: relative; | ||
display: flex; | ||
width: 100%; | ||
height: 44px; | ||
background-color: var(--neutral-bone); | ||
border-bottom: 1px solid var(--neutral-carbon); | ||
} | ||
|
||
.search.block form input { | ||
position: relative; | ||
width: 100%; | ||
box-sizing: border-box; | ||
background-position: 14px 12px; | ||
background-repeat: no-repeat; | ||
padding: 8px 16px; | ||
border: 0; | ||
background-color: var(--neutral-bone); | ||
} | ||
|
||
.search.block form span.search-icon { | ||
display: block; | ||
position: relative; | ||
background: url('../../icons/search.svg') no-repeat; | ||
color: #000; | ||
height: 24px; | ||
width: 24px; | ||
margin: 13px 13px 0 0; | ||
padding: 0 23px 0 0; | ||
min-width: 14px; | ||
} | ||
|
||
.search.block div.results ul { | ||
max-height: 280px; | ||
overflow-y: auto; | ||
padding: unset; | ||
} | ||
|
||
.search.block div.results ul li { | ||
padding: 15px 16px; | ||
text-decoration: none; | ||
display: block; | ||
border-bottom: 1px solid #e7e2da; | ||
} | ||
|
||
.search.block div.results ul li:hover { | ||
background-color: #ebccff; | ||
} | ||
|
||
.search.block div.results ul li a { | ||
text-decoration: none; | ||
border: unset; | ||
color: var(--neutral-carbon); | ||
} | ||
|
||
@media only screen and (min-width: 768px) { | ||
/* Tablet styles */ | ||
.search.block { | ||
width: 700px; | ||
} | ||
} | ||
|
||
@media only screen and (min-width: 1200px) { | ||
/* Desktop styles */ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { createTag, getSearchIndex } from '../../scripts/scripts.js'; | ||
import { readBlockConfig } from '../../scripts/lib-franklin.js'; | ||
|
||
let index; | ||
let searchTerm = ''; | ||
let results; | ||
|
||
async function showResults() { | ||
// clear the results | ||
results.innerHTML = ''; | ||
// filter and redraw the results | ||
const ul = createTag('ul'); | ||
index | ||
.filter((row) => (row.title.toLowerCase().includes(searchTerm.toLowerCase()) | ||
|| row.description.toLowerCase().includes(searchTerm.toLowerCase()))) | ||
.forEach((row) => { | ||
const link = createTag('a', { href: row.path, 'aria-label': row.title }, row.title); | ||
const li = createTag('li', { class: 'search-result' }, link); | ||
ul.append(li); | ||
}); | ||
results.append(ul); | ||
} | ||
|
||
export default async function decorate(block) { | ||
const cfg = await readBlockConfig(block); | ||
block.textContent = ''; | ||
const filter = cfg.filter || ''; | ||
index = await getSearchIndex(filter); | ||
const input = createTag('input', { | ||
type: 'text', | ||
placeholder: 'Type a search term or article type, such as release notes or news.', | ||
}); | ||
const form = createTag('form', { onsubmit: 'event.preventDefault();' }, input); | ||
const searchIcon = createTag('span', { class: 'search-icon' }); | ||
results = createTag('div', { class: 'results' }); | ||
form.append(searchIcon); | ||
block.append(form); | ||
block.append(results); | ||
|
||
// Search input listener | ||
input.addEventListener('input', async (e) => { | ||
// saving the input value | ||
searchTerm = e.target.value; | ||
// re-displaying results based on the new search_term | ||
await showResults(); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add this neutral 40% hex color variable to our
style.css
---neutral-40: F3F1ED;