feat: centralize brand information in package data and integrate dynamically into contact and footer sections

This commit is contained in:
Firman Ramdhani
2026-07-29 16:44:16 +07:00
parent 90dea678dd
commit 5f87a9f2e3
6 changed files with 27 additions and 20 deletions
-1
View File
@@ -196,7 +196,6 @@
"email": "Email", "email": "Email",
"phone": "Phone / WhatsApp", "phone": "Phone / WhatsApp",
"office": "Office", "office": "Office",
"address": "Jl. Soekarno-Hatta No.409, Karasak, Kec. Astanaanyar, Bandung City, West Java 40243",
"form": { "form": {
"title": "Send a message to our team", "title": "Send a message to our team",
"name": "Full name", "name": "Full name",
-1
View File
@@ -196,7 +196,6 @@
"email": "Email", "email": "Email",
"phone": "Telepon / WhatsApp", "phone": "Telepon / WhatsApp",
"office": "Kantor", "office": "Kantor",
"address": "Jl. Soekarno-Hatta No.409, Karasak, Kec. Astanaanyar, Kota Bandung, Jawa Barat 40243",
"form": { "form": {
"title": "Kirim pesan ke tim kami", "title": "Kirim pesan ke tim kami",
"name": "Nama lengkap", "name": "Nama lengkap",
@@ -1,25 +1,27 @@
'use client'; 'use client';
import { useTranslations } from 'next-intl'; import { useTranslations, useLocale } from 'next-intl';
import { brandInfo } from '@repo/brand';
export function Contact() { export function Contact() {
const t = useTranslations(); const t = useTranslations();
const locale = useLocale() as 'id' | 'en';
const contactList = [ const contactList = [
{ {
icon: 'uil-envelope-alt', icon: 'uil-envelope-alt',
titleKey: 'Contact.email', titleKey: 'Contact.email',
value: 'hello@pintumasuk.id', value: brandInfo.email,
}, },
{ {
icon: 'uil-phone', icon: 'uil-phone',
titleKey: 'Contact.phone', titleKey: 'Contact.phone',
value: '+62 812-3456-7890', value: brandInfo.phone,
}, },
{ {
icon: 'uil-map-marker', icon: 'uil-map-marker',
titleKey: 'Contact.office', titleKey: 'Contact.office',
valueKey: 'Contact.address', value: brandInfo.address[locale] || brandInfo.address.id,
}, },
]; ];
@@ -43,7 +45,7 @@ export function Contact() {
</div> </div>
<div> <div>
<b>{(t as any)(item.titleKey)}</b> <b>{(t as any)(item.titleKey)}</b>
<span>{item.valueKey ? (t as any)(item.valueKey) : item.value}</span> <span>{item.value}</span>
</div> </div>
</div> </div>
))} ))}
@@ -1,7 +1,9 @@
import { useTranslations } from 'next-intl'; import { useTranslations, useLocale } from 'next-intl';
import { brandInfo } from '@repo/brand';
export function Footer() { export function Footer() {
const t = useTranslations(); const t = useTranslations();
const locale = useLocale() as 'id' | 'en';
const footerLinks = [ const footerLinks = [
{ labelKey: 'Nav.home', href: '#' }, { labelKey: 'Nav.home', href: '#' },
@@ -12,9 +14,9 @@ export function Footer() {
]; ];
const socialLinks = [ const socialLinks = [
{ icon: 'uil-envelope-alt', href: '#' }, { icon: 'uil-envelope-alt', href: brandInfo.socialLinks.email },
{ icon: 'uil-phone', href: '#' }, { icon: 'uil-phone', href: brandInfo.socialLinks.phone },
{ icon: 'uil-youtube', href: '#' }, { icon: 'uil-youtube', href: brandInfo.socialLinks.youtube },
]; ];
return ( return (
@@ -31,7 +33,7 @@ export function Footer() {
<span className="brand-name" style={{ color: '#fff' }}></span> <span className="brand-name" style={{ color: '#fff' }}></span>
</div> </div>
<p>{t('Footer.desc')}</p> <p>{t('Footer.desc')}</p>
<p className="address">{t('Contact.address')}</p> <p className="address">{brandInfo.address[locale] || brandInfo.address.id}</p>
</div> </div>
<div className="footer-cols"> <div className="footer-cols">
<div className="footer-col"> <div className="footer-col">
@@ -44,8 +46,8 @@ export function Footer() {
</div> </div>
<div className="footer-col"> <div className="footer-col">
<h5>{t('Nav.contact')}</h5> <h5>{t('Nav.contact')}</h5>
<a href="mailto:hello@pintumasuk.id">hello@pintumasuk.id</a> <a href={`mailto:${brandInfo.email}`}>{brandInfo.email}</a>
<a href="tel:+6281234567890">+62 812-3456-7890</a> <a href={`tel:${brandInfo.phone.replace(/[\s-]/g, '')}`}>{brandInfo.phone}</a>
</div> </div>
</div> </div>
</div> </div>
+10 -6
View File
@@ -1,10 +1,14 @@
{ {
"name": "My Brand", "name": "Pintu Masuk",
"description": "A short description of your brand or product.", "email": "hello@pintumasuk.id",
"tagline": "Building the future, one pixel at a time.", "phone": "+62 812-3456-7890",
"address": {
"id": "Jl. Soekarno-Hatta No.409, Karasak, Kec. Astanaanyar, Kota Bandung, Jawa Barat 40243",
"en": "Jl. Soekarno-Hatta No.409, Karasak, Kec. Astanaanyar, Bandung City, West Java 40243"
},
"socialLinks": { "socialLinks": {
"twitter": "https://twitter.com/mybrand", "email": "mailto:hello@pintumasuk.id",
"github": "https://github.com/mybrand", "phone": "tel:+6281234567890",
"website": "https://mybrand.com" "youtube": "https://youtube.com/"
} }
} }
+1
View File
@@ -1,3 +1,4 @@
import brandInfo from './data/info.json'; import brandInfo from './data/info.json';
export type BrandInfo = typeof brandInfo; export type BrandInfo = typeof brandInfo;
export { brandInfo };