mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-08-02 19:31:19 -04:00
Do not render protocol and subdomain in socials
This commit is contained in:
@@ -20,7 +20,9 @@ export function UserHandles(props: { links: Socials; className?: string }) {
|
||||
Object.entries(links),
|
||||
([platform]) => -[...SITE_ORDER].reverse().indexOf(platform as Site)
|
||||
).map(([platform, label]) => {
|
||||
const renderedLabel: string = LABELS_TO_RENDER.includes(platform) ? PLATFORM_LABELS[platform as Site] : label
|
||||
let renderedLabel: string = LABELS_TO_RENDER.includes(platform) ? PLATFORM_LABELS[platform as Site] : label
|
||||
renderedLabel = renderedLabel?.replace(/\/+$/, '') // remove trailing slashes
|
||||
renderedLabel = renderedLabel?.replace(/^(https?:\/\/)?(www\.)?/, '') // remove protocol and www
|
||||
return {
|
||||
platform,
|
||||
label: renderedLabel,
|
||||
|
||||
Reference in New Issue
Block a user