diff --git a/wp-content/themes/moonshine/app/utils/map-social-icon.ts b/wp-content/themes/moonshine/app/utils/map-social-icon.ts new file mode 100644 index 0000000..a67316e --- /dev/null +++ b/wp-content/themes/moonshine/app/utils/map-social-icon.ts @@ -0,0 +1,21 @@ +const socialIconMap = { + "facebook.com": "i-cib-facebook-f", + "twitter.com": "i-cib-twitter", + "x.com": "i-cib-twitter", + "instagram.com": "i-cib-instagram", + "youtube.com": "i-cib-youtube", + "linkedin.com": "i-cib-linkedin", + "tiktok.com": "i-cib-tiktok", +}; + +export function mapSocialIcon(url: string) { + try { + const domain = new URL(url).hostname.toLowerCase().replace(/^www\./, ""); + const icon = socialIconMap[domain as keyof typeof socialIconMap]; + if (!icon) throw new Error(`Média social introuvable ${url}`); + return icon; + } + catch { + return "i-lucide-globe"; + } +} diff --git a/wp-content/themes/moonshine/package.json b/wp-content/themes/moonshine/package.json index 503ccba..ab53851 100644 --- a/wp-content/themes/moonshine/package.json +++ b/wp-content/themes/moonshine/package.json @@ -15,8 +15,9 @@ "typecheck": "nuxt typecheck" }, "dependencies": { + "@iconify-json/cib": "^1.2.3", "@iconify-json/lucide": "^1.2.87", - "@lewebsimple/nuxt-graphql": "^0.6.7", + "@lewebsimple/nuxt-graphql": "^0.6.8", "@nuxt/image": "^2.0.0", "@nuxt/ui": "4.3.0", "@nuxtjs/device": "4.0.0", diff --git a/wp-content/themes/moonshine/pnpm-lock.yaml b/wp-content/themes/moonshine/pnpm-lock.yaml index f0056ab..57d7ad6 100644 --- a/wp-content/themes/moonshine/pnpm-lock.yaml +++ b/wp-content/themes/moonshine/pnpm-lock.yaml @@ -12,12 +12,15 @@ importers: .: dependencies: + '@iconify-json/cib': + specifier: ^1.2.3 + version: 1.2.3 '@iconify-json/lucide': specifier: ^1.2.87 version: 1.2.87 '@lewebsimple/nuxt-graphql': - specifier: ^0.6.7 - version: 0.6.7(db0@0.3.4)(ioredis@5.9.2)(magicast@0.5.1) + specifier: ^0.6.8 + version: 0.6.8(db0@0.3.4)(ioredis@5.9.2)(magicast@0.5.1) '@nuxt/image': specifier: ^2.0.0 version: 2.0.0(db0@0.3.4)(ioredis@5.9.2)(magicast@0.5.1) @@ -1060,6 +1063,9 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} + '@iconify-json/cib@1.2.3': + resolution: {integrity: sha512-MMvRXVTHt82z3bYN19JDAjv/X8OBNC/1B3I334SV/1nyhdPeeyvJZVoI1cGuNqYznBjMnWxKPtIhhiVgGQ1CzQ==} + '@iconify-json/lucide@1.2.87': resolution: {integrity: sha512-wxYIAp0f8Uw0rJa6BMWMaRbiHk3yV4XczA38GKXFlqyZtTdmHM1QOF4NZw5xpMlRDzbh2MnB7wjteLeFnn/ciQ==} @@ -1267,8 +1273,8 @@ packages: '@kwsites/promise-deferred@1.1.1': resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==} - '@lewebsimple/nuxt-graphql@0.6.7': - resolution: {integrity: sha512-/7jol50YtpKdUlVIliDI0IH9z9D8Gk0pm6Jc1q7CL6TTOKlJKnCmLw0KsjmmmniUgtBQjyh/G+VqXu60iRgRYg==} + '@lewebsimple/nuxt-graphql@0.6.8': + resolution: {integrity: sha512-b7QYVQx4OeiWmO8qY5CDxFC+Vnafn92ak8ApijA4C4t1lrJ/QjFl5avdATOWeTsskHBvq0QI3rGE2O144iBZGA==} '@mapbox/node-pre-gyp@2.0.3': resolution: {integrity: sha512-uwPAhccfFJlsfCxMYTwOdVfOz3xqyj8xYL3zJj8f0pb30tLohnnFPhLuqp4/qoEz8sNxe4SESZedcBojRefIzg==} @@ -7426,6 +7432,10 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} + '@iconify-json/cib@1.2.3': + dependencies: + '@iconify/types': 2.0.0 + '@iconify-json/lucide@1.2.87': dependencies: '@iconify/types': 2.0.0 @@ -7609,7 +7619,7 @@ snapshots: '@kwsites/promise-deferred@1.1.1': {} - '@lewebsimple/nuxt-graphql@0.6.7(db0@0.3.4)(ioredis@5.9.2)(magicast@0.5.1)': + '@lewebsimple/nuxt-graphql@0.6.8(db0@0.3.4)(ioredis@5.9.2)(magicast@0.5.1)': dependencies: '@graphql-codegen/core': 5.0.0(graphql@16.12.0) '@graphql-codegen/typed-document-node': 6.1.5(graphql@16.12.0) @@ -11514,7 +11524,7 @@ snapshots: lower-case@2.0.2: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 lru-cache@10.4.3: {} @@ -13461,7 +13471,7 @@ snapshots: upper-case@2.0.2: dependencies: - tslib: 2.6.3 + tslib: 2.8.1 uqr@0.1.2: {}