Skip to content
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

Fix sitegen theme marker script #443

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"build": "wp-scripts build ./src/onboarding.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.css",
"format": "wp-scripts format ./src",
"start": "wp-scripts start ./src/onboarding.js",
"start": "wp-scripts start ./src/onboarding.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js ./src/Scripts/sitegen-theme-marker/sitegen-theme-marker.css",
"lint:js": "wp-scripts lint-js ./src",
"lint:js:fix": "wp-scripts lint-js ./src --fix",
"test:e2e": "npx cypress run",
Expand Down
11 changes: 5 additions & 6 deletions src/Scripts/sitegen-theme-marker/sitegen-theme-marker.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
window.onload = function () {
window.onload = function() {
const homepages = window.nfdOnboarding.homepages.data;
const activeTheme = window.nfdOnboarding.active;
homepages.forEach( ( homepage ) => {
const ele = document.getElementById( `${ homepage.slug }-name` );
Object.keys( homepages ).forEach( ( slug ) => {
const homepage = homepages[ slug ];
const ele = document.getElementById( `${ slug }-name` );
if ( ele ) {
ele.innerHTML =
( activeTheme === homepage.slug
? '<span>Active:</span>'
: '' ) +
( activeTheme === slug ? '<span>Active:</span>' : '' ) +
`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10 19.6584L8.975 18.7334C7.20833 17.1167 5.75 15.7209 4.6 14.5459C3.45 13.3709 2.53333 12.3209 1.85 11.3959C1.16667 10.4709 0.6875 9.63338 0.4125 8.88337C0.1375 8.13337 0 7.37504 0 6.60837C0 5.10837 0.504167 3.85421 1.5125 2.84587C2.52083 1.83754 3.76667 1.33337 5.25 1.33337C6.2 1.33337 7.07917 1.55837 7.8875 2.00837C8.69583 2.45837 9.4 3.10837 10 3.95837C10.7 3.05837 11.4417 2.39587 12.225 1.97087C13.0083 1.54587 13.85 1.33337 14.75 1.33337C16.2333 1.33337 17.4792 1.83754 18.4875 2.84587C19.4958 3.85421 20 5.10837 20 6.60837C20 7.37504 19.8625 8.13337 19.5875 8.88337C19.3125 9.63338 18.8333 10.4709 18.15 11.3959C17.4667 12.3209 16.55 13.3709 15.4 14.5459C14.25 15.7209 12.7917 17.1167 11.025 18.7334L10 19.6584Z" fill="#EF4A71"/>
</svg>
Expand Down
Loading