Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit d52ccfc

Browse files
feat: use the custom logo, if defined, to render social custom link
1 parent 90cf573 commit d52ccfc

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

studio/src/app/utils/editor/header-footer.utils.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class HeaderFooterUtils {
2626
deck.removeChild(currentSlotElement);
2727
}
2828

29-
const promises: Promise<HTMLElement>[] = [this.createContainer(slotName), this.createSocial(user, type), this.createImg(type)];
29+
const promises: Promise<HTMLElement>[] = [this.createContainer(slotName), this.createSocial(user, type), this.createImg(user, type)];
3030
const [div, social, deckgoImg] = await Promise.all(promises);
3131

3232
social.appendChild(deckgoImg);
@@ -60,7 +60,7 @@ export class HeaderFooterUtils {
6060
return socialElement;
6161
}
6262

63-
private static async createImg(type: 'twitter' | 'linkedin' | 'dev' | 'medium' | 'github' | 'custom'): Promise<HTMLElement> {
63+
private static async createImg(user: User, type: 'twitter' | 'linkedin' | 'dev' | 'medium' | 'github' | 'custom'): Promise<HTMLElement> {
6464
const deckgoImg: HTMLElement = document.createElement(SlotType.IMG);
6565
deckgoImg.setAttribute('slot', 'icon');
6666
deckgoImg.setAttribute('aria-label', type);
@@ -71,6 +71,8 @@ export class HeaderFooterUtils {
7171
deckgoImg.setAttribute('svg-src', `${config.globalAssetsUrl}/icons/ionicons/${type}.svg`);
7272
} else if (type === 'medium' || type === 'dev') {
7373
deckgoImg.setAttribute('svg-src', `${config.globalAssetsUrl}/icons/${type}.svg`);
74+
} else if (user.data.social.custom_logo_url !== undefined && user.data.social.custom_logo_url !== '') {
75+
deckgoImg.setAttribute('img-src', user.data.social.custom_logo_url);
7476
} else {
7577
deckgoImg.setAttribute('svg-src', `${config.globalAssetsUrl}/icons/ionicons/globe.svg`);
7678
}

studio/src/app/utils/editor/social.utils.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,23 @@ export class SocialUtils {
4141
}
4242

4343
static createCustom(user: User): JSX.IntrinsicElements {
44-
const config: EnvironmentDeckDeckGoConfig = EnvironmentConfigService.getInstance().get('deckdeckgo');
45-
4644
return (
4745
<deckgo-social slot={`social-link`} fullUrl={user.data.social.custom}>
48-
<deckgo-lazy-img slot="icon" svg-src={`${config.globalAssetsUrl}/icons/ionicons/globe.svg`} aria-label="Web"></deckgo-lazy-img>
46+
{this.createCustomLogo(user)}
4947
</deckgo-social>
5048
);
5149
}
5250

51+
private static createCustomLogo(user: User): JSX.IntrinsicElements {
52+
if (user.data.social.custom_logo_url) {
53+
return <deckgo-lazy-img slot="icon" img-src={user.data.social.custom_logo_url} aria-label="Web"></deckgo-lazy-img>;
54+
}
55+
56+
const config: EnvironmentDeckDeckGoConfig = EnvironmentConfigService.getInstance().get('deckdeckgo');
57+
58+
return <deckgo-lazy-img slot="icon" svg-src={`${config.globalAssetsUrl}/icons/ionicons/globe.svg`} aria-label="Web"></deckgo-lazy-img>;
59+
}
60+
5361
static createGitHub(user: User): JSX.IntrinsicElements {
5462
const config: EnvironmentDeckDeckGoConfig = EnvironmentConfigService.getInstance().get('deckdeckgo');
5563

0 commit comments

Comments
 (0)