-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add semantics to contact information
- Loading branch information
1 parent
49f4e1e
commit 75710e5
Showing
1 changed file
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,9 @@ type Goal = { | |
type Contact = { | ||
alt: string; | ||
description: string; | ||
href?: string; | ||
src: string; | ||
tag: keyof HTMLElementTagNameMap; | ||
}; | ||
|
||
type Img = { | ||
|
@@ -98,16 +100,21 @@ const CONTACTS: Contact[] = [ | |
alt: 'location greenshop', | ||
description: '70 West Buckingham Ave. Farmingdale, NY 11735', | ||
src: '/img/png/location.png', | ||
tag: 'address', | ||
}, | ||
{ | ||
alt: 'email greenshop', | ||
description: '[email protected]', | ||
href: 'mailto:[email protected]', | ||
src: '/img/png/message.png', | ||
tag: 'a', | ||
}, | ||
{ | ||
alt: 'phone greenshop', | ||
description: '+88 01911 717 490', | ||
href: 'tel:+8801911717490', | ||
src: '/img/png/calling.png', | ||
tag: 'a', | ||
}, | ||
]; | ||
|
||
|
@@ -250,11 +257,19 @@ class FooterView { | |
return wrap; | ||
} | ||
|
||
private createContactItemHTML(contact: Contact): HTMLDivElement { | ||
private createContactItemHTML(contact: Contact): HTMLElement { | ||
const attributes: { [key: string]: string } = {}; | ||
|
||
if (contact.href) { | ||
attributes.href = contact.href; | ||
} | ||
|
||
const wrap = createBaseElement({ | ||
attributes, | ||
cssClasses: [styles.contactItem], | ||
tag: 'div', | ||
tag: contact.tag, | ||
}); | ||
|
||
const icon = createBaseElement({ | ||
attributes: { | ||
alt: contact.alt, | ||
|
@@ -263,11 +278,13 @@ class FooterView { | |
cssClasses: [styles.contactIcon], | ||
tag: 'img', | ||
}); | ||
|
||
const title = createBaseElement({ | ||
cssClasses: [styles.contactText], | ||
innerContent: contact.description, | ||
tag: 'p', | ||
tag: 'span', | ||
}); | ||
|
||
wrap.append(icon, title); | ||
return wrap; | ||
} | ||
|
75710e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update footer with semantic contacts