-
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.
- Loading branch information
1 parent
78f18b0
commit 5223fa7
Showing
13 changed files
with
526 additions
and
272 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,22 @@ | ||
# Ignore dot files | ||
.githooks | ||
.github | ||
.storybook | ||
.vscode | ||
.xata | ||
|
||
# Ignore build files | ||
build | ||
dist | ||
|
||
# Ignore generated | ||
coverage | ||
node_modules | ||
|
||
# Ignore assets | ||
docs | ||
scripts | ||
|
||
# file types | ||
# **/.json | ||
# **/.yml |
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,14 @@ | ||
{ | ||
"typescript.preferences.quoteStyle": "single", | ||
"prettier.trailingComma": "all", | ||
"prettier.tabWidth": 2, | ||
"prettier.semi": true, | ||
"prettier.singleQuote": true, | ||
"prettier.printWidth": 100, | ||
"cSpell.words": [ | ||
"Imgs", | ||
"NMSCD", | ||
"noselect", | ||
"urlref" | ||
] | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,18 +1,78 @@ | ||
const registerServiceWorker = async () => { | ||
if ('serviceWorker' in navigator) { | ||
try { | ||
const registration = await navigator.serviceWorker.register('/serviceWorker.js'); | ||
if (registration.installing) { | ||
console.log('Service worker installing'); | ||
} else if (registration.waiting) { | ||
console.log('Service worker installed'); | ||
} else if (registration.active) { | ||
console.log('Service worker active'); | ||
} | ||
} catch (error) { | ||
console.error(`Registration failed with ${error}`); | ||
} | ||
if ('serviceWorker' in navigator) { | ||
try { | ||
const registration = await navigator.serviceWorker.register('/serviceWorker.js'); | ||
if (registration.installing) { | ||
console.log('Service worker installing'); | ||
} else if (registration.waiting) { | ||
console.log('Service worker installed'); | ||
} else if (registration.active) { | ||
console.log('Service worker active'); | ||
} | ||
} catch (error) { | ||
console.error(`Registration failed with ${error}`); | ||
} | ||
} | ||
}; | ||
|
||
const setCardDisplay = (btn) => { | ||
const selectedClass = 'selected'; | ||
document.querySelectorAll('.project-btn').forEach((node) => { | ||
node.classList.remove(selectedClass); | ||
}); | ||
btn.classList.add(selectedClass); | ||
|
||
const projectSection = document.querySelector('section.projects'); | ||
projectSection.classList.forEach((cls) => { | ||
if (cls != 'projects') { | ||
projectSection.classList.remove(cls); | ||
} | ||
}); | ||
projectSection.classList.add(btn.dataset['class']); | ||
}; | ||
|
||
const onSearchChange = (searchString) => { | ||
console.log(searchString); | ||
document.querySelectorAll('article.row.project-tile').forEach((node) => { | ||
const title = node.dataset['title'] ?? ''; | ||
const description = node.dataset['description'] ?? ''; | ||
|
||
const containsTitle = title.toLowerCase().includes(searchString.toLowerCase()); | ||
const containsDescription = description.toLowerCase().includes(searchString.toLowerCase()); | ||
|
||
let orderValue = 3; | ||
node.style.setProperty('opacity', 1); | ||
node.style.setProperty('order', orderValue); | ||
|
||
const headingNode = node.querySelector('.text-column h3'); | ||
const descriptionNode = node.querySelector('.text-column p'); | ||
if (containsTitle | containsDescription) { | ||
if (containsTitle) orderValue -= 2; | ||
if (containsDescription) orderValue -= 1; | ||
node.style.setProperty('order', orderValue); | ||
highlight(headingNode, title, searchString); | ||
highlight(descriptionNode, description, searchString); | ||
} else { | ||
node.style.setProperty('opacity', '0.25'); | ||
headingNode.innerHTML = title; | ||
descriptionNode.innerHTML = description; | ||
} | ||
}); | ||
}; | ||
|
||
const highlight = (node, text, searchString) => { | ||
const index = text.toLowerCase().indexOf(searchString.toLowerCase()); | ||
if (index >= 0) { | ||
const innerHTML = | ||
text.substring(0, index) + | ||
"<span class='highlight'>" + | ||
text.substring(index, index + searchString.length) + | ||
'</span>' + | ||
text.substring(index + searchString.length); | ||
node.innerHTML = innerHTML; | ||
} else { | ||
node.innerHTML = text; | ||
} | ||
}; | ||
|
||
registerServiceWorker(); |
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
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
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
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
Oops, something went wrong.