Skip to content

Commit

Permalink
Merge pull request #340 from Shinsina/podcast-adjustments
Browse files Browse the repository at this point in the history
Podcast Social Link Adjustments
  • Loading branch information
B77Mills authored May 13, 2024
2 parents bb4a8a8 + a9069af commit aff11ea
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,24 @@ $ const perPage = 10;
</h5>
<theme-content-contact-details-section block-name="social-follow" modifiers=["social-links"]>
<for|item| of=podcastLinks>
<theme-social-icon-link
label=item.label
provider=item.provider
href=item.href
modifiers=["dark", "xl"]
/>
<if(item.label !== "Amazon")>
<theme-social-icon-link
label=item.label
provider=item.provider
href=item.href
target="_blank"
modifiers=["dark", "xl", "podcast-icon"]
/>
</if>
<else>
<global-social-icon-link
label=item.label
provider=item.provider
href=item.href
target="_blank"
modifiers=["dark", "xl", "podcast-icon"]
/>
</else>
</for>
</theme-content-contact-details-section>
</@section>
Expand Down
3 changes: 3 additions & 0 deletions packages/global/components/marko.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
},
"<global-site-footer>": {
"template": "./site-footer.marko"
},
"<global-social-icon-link>": {
"template": "./social-icon-link.marko"
}
}
54 changes: 54 additions & 0 deletions packages/global/components/social-icon-link.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { readFileSync } from 'fs';
import { resolve } from 'path';
import { get } from "@parameter1/base-cms-object-path";
import createClasses from "@parameter1/base-cms-marko-web-icons/utils/create-classes";

$ const getProvider = ({ provider, label }) => {
let formatted = provider ? `${provider}`.toLowerCase() : '';
if (formatted === 'other' && label) formatted = `${label}`.toLowerCase();
return formatted;
};
$ const load = () => {
try {
const file = resolve(__dirname, `../svg/${input.provider}.svg`);
return readFileSync(file, 'utf8').toString();
} catch (e) {
return null;
}
};
$ const blockName = input.blockName || 'marko-web-icon';
$ const className = input.className || "social-icon-link";
$ const provider = get(input, "provider", "");
$ const label = get(input, "label", "");

$ const formatted = getProvider({ provider, label });
$ const name = label || provider;
$ const title = name ? `Visit us on ${name.charAt(0).toUpperCase()}${name.slice(1)}` : null;
$ const svg = load();

$ const classNames = createClasses({
iconName: name,
blockName,
modifiers: input.modifiers,
});

<if(formatted && input.href && svg)>
$ const tag = input.tag || 'span';
<marko-web-link
class=className
href=input.href
target=input.target
title=title
attrs=input.attrs
>
<${tag} ...input.attrs class=classNames>$!{svg}</>
</marko-web-link>
</if>
<else>
<theme-social-icon-link
...input
/>
</else>
5 changes: 5 additions & 0 deletions packages/global/scss/components/_podcasts-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@
.watch-latest-rail {
text-align: center;
}

.marko-web-icon--podcast-icon svg {
height: 5rem;
width: 5rem;
}
2 changes: 2 additions & 0 deletions packages/global/svg/amazon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sites/diverseeducation.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
},
podcastLinks: [
{ provider: 'applepodcasts', label: 'Apple Podcasts', href: 'https://podcasts.apple.com/us/podcast/in-the-margins/id1540117090' },
{ provider: 'prime', label: 'Amazon', href: 'https://music.amazon.com/podcasts/cc87b264-f43c-4d79-a423-84e18364640b/in-the-margins' },
{ provider: 'amazon', label: 'Amazon', href: 'https://music.amazon.com/podcasts/cc87b264-f43c-4d79-a423-84e18364640b/in-the-margins' },
{ provider: 'spotify', label: 'Spotify', href: 'https://open.spotify.com/show/6FSDlxj88XFUgOsfeftBfP' },
{ provider: 'youtube', label: 'YouTube', href: 'https://www.youtube.com/playlist?list=PL6yKpacB8wLWYUWHMgGMtG5G7kEHuKrHK' },
],
Expand Down

0 comments on commit aff11ea

Please sign in to comment.