-
+
github.com/imasiprojects/ImasiEngine
diff --git a/lib/generators/leftColumn/contactItemGenerator.ts b/lib/generators/leftColumn/contactItemGenerator.ts
index e12fd5a..09afa07 100644
--- a/lib/generators/leftColumn/contactItemGenerator.ts
+++ b/lib/generators/leftColumn/contactItemGenerator.ts
@@ -1,25 +1,17 @@
-import { assets } from "../../assets";
+import { makeLink } from "../../links";
import { generatorFrom } from "../../utils";
export const generateContactItem = generatorFrom(async function* (contactItem: {
type: string;
URL: string;
}) {
- yield `
-
${
- urlText || details.description
+ link || details.description
? `
${
- urlText
+ link
? `
-
-
- ${urlText}
+
+
+ ${link.text}
`
: ""
@@ -69,7 +65,7 @@ export const generateHighlights = generatorFrom(async function* (highlights: Hig
${
highlight.publishingDate
? `
${new Date(
- highlight.publishingDate
+ highlight.publishingDate,
).toLocaleDateString("en-US", { month: "2-digit", year: "numeric" })}
`
: ""
}
diff --git a/lib/generators/rightColumn/jobsGenerator.ts b/lib/generators/rightColumn/jobsGenerator.ts
index 6b4bbe7..b004b20 100644
--- a/lib/generators/rightColumn/jobsGenerator.ts
+++ b/lib/generators/rightColumn/jobsGenerator.ts
@@ -1,4 +1,5 @@
import { assets } from "../../assets";
+import { makeLink } from "../../links";
import { Job } from "../../mac";
import { generatorFrom, sortByDates } from "../../utils";
import { generateRoles } from "../common/rolesGenerator";
@@ -36,10 +37,12 @@ export const generateJobs = generatorFrom(async function* (jobs: Job[]) {
`;
if (organization.URL) {
+ const link = await makeLink(organization.URL);
+
yield `
-
-
- ${decodeURI(organization.URL.replace(/https?:\/\//, ""))}
+
+
+ ${link.text}
`;
}
diff --git a/lib/generators/rightColumn/projectsGenerator.ts b/lib/generators/rightColumn/projectsGenerator.ts
index 38caa9d..ab14492 100644
--- a/lib/generators/rightColumn/projectsGenerator.ts
+++ b/lib/generators/rightColumn/projectsGenerator.ts
@@ -4,6 +4,7 @@ import { Project } from "../../mac";
import { generatorFrom, sortByDates } from "../../utils";
import { generateRoles } from "../common/rolesGenerator";
import { generateTypeLabels } from "../common/typeLabelGenerator";
+import { makeLink } from "../../links";
export const generateProjects = generatorFrom(async function* (projects: Project[]) {
if (projects.length) {
@@ -23,10 +24,7 @@ export const generateProjects = generatorFrom(async function* (projects: Project
imageAlt = details.image.alt as string;
}
- let urlText = "";
- if (details?.URL) {
- urlText = `${decodeURI(details.URL.replace(/https?:\/\//, ""))}`;
- }
+ const link = await makeLink(details?.URL);
yield `
@@ -38,15 +36,15 @@ export const generateProjects = generatorFrom(async function* (projects: Project
${
- urlText || details?.description
+ link || details?.description
? `
${
- urlText
+ link
? `
-
-
- ${urlText}
+
+
+ ${link.text}
`
: ""
diff --git a/lib/generators/rightColumn/studiesGenerator.ts b/lib/generators/rightColumn/studiesGenerator.ts
index 06c4624..2c2baa4 100644
--- a/lib/generators/rightColumn/studiesGenerator.ts
+++ b/lib/generators/rightColumn/studiesGenerator.ts
@@ -4,6 +4,7 @@ import { Study } from "../../mac";
import { generatorFrom, sortByDates } from "../../utils";
import { generateSkills } from "../common/skillsGenerator";
import { generateTypeLabels } from "../common/typeLabelGenerator";
+import { makeLink } from "../../links";
export const generateStudies = generatorFrom(async function* (studies: Study[]) {
if (studies.length) {
@@ -34,10 +35,12 @@ export const generateStudies = generatorFrom(async function* (studies: Study[])
`;
if (institution?.URL) {
+ const link = await makeLink(institution.URL);
+
yield `
-
-
- ${decodeURI(institution.URL.replace(/https?:\/\//, ""))}
+
+
+ ${link.text}
`;
}
@@ -51,16 +54,16 @@ export const generateStudies = generatorFrom(async function* (studies: Study[])
month: "2-digit",
year: "numeric",
})} ${
- study.finishDate
- ? " - " +
- new Date(study.finishDate).toLocaleDateString("en-US", {
- month: "2-digit",
- year: "numeric",
- })
- : study.studyType !== "certification"
- ? " - Present"
- : ""
- }
+ study.finishDate
+ ? " - " +
+ new Date(study.finishDate).toLocaleDateString("en-US", {
+ month: "2-digit",
+ year: "numeric",
+ })
+ : study.studyType !== "certification"
+ ? " - Present"
+ : ""
+ }
${study.name}
diff --git a/lib/links.ts b/lib/links.ts
new file mode 100644
index 0000000..aad56f2
--- /dev/null
+++ b/lib/links.ts
@@ -0,0 +1,50 @@
+import { assets } from "./assets";
+
+type LinkData = {
+ url: string;
+ text: string;
+ icon: string;
+ alt: string;
+};
+
+export async function makeLink(url: string): Promise;
+export async function makeLink(url?: string): Promise;
+export async function makeLink(url?: string): Promise {
+ if (!url) {
+ return undefined;
+ }
+
+ return {
+ url: url,
+ text: `${decodeURI(url.replace(/https?:\/\//, ""))}`,
+ ...(await iconForUrl(url)),
+ };
+}
+
+async function iconForUrl(url: string) {
+ if (url.includes("github.com")) {
+ return {
+ icon: await assets.githubIcon,
+ alt: "GitHub",
+ };
+ }
+
+ if (url.includes("twitter.com")) {
+ return {
+ icon: await assets.twitterIcon,
+ alt: "Twitter",
+ };
+ }
+
+ if (url.includes("linkedin.com")) {
+ return {
+ icon: await assets.linkedinIcon,
+ alt: "LinkedIn",
+ };
+ }
+
+ return {
+ icon: await assets.linkIcon,
+ alt: "Link",
+ };
+}
diff --git a/sass/right-column.scss b/sass/right-column.scss
index 4f71b36..1353957 100644
--- a/sass/right-column.scss
+++ b/sass/right-column.scss
@@ -70,14 +70,15 @@
}
.right-column__job-organization-url {
- display: block;
+ @include linear-layout(row, 1em, $center: true);
+
font-size: 0.8em;
text-decoration: none;
color: #55a;
.right-column__job-organization-url-icon {
- width: 1em;
- height: 1em;
+ width: 1.2em;
+ height: 1.2em;
object-fit: contain;
}
}
@@ -132,14 +133,15 @@
}
.right-column__study-institution-url {
- display: block;
+ @include linear-layout(row, 1em, $center: true);
+
font-size: 0.8em;
text-decoration: none;
color: #55a;
.right-column__study-institution-url-icon {
- width: 1em;
- height: 1em;
+ width: 1.2em;
+ height: 1.2em;
object-fit: contain;
}
}
@@ -195,13 +197,15 @@
margin-bottom: 1em;
.right-column__project-details-url {
+ @include linear-layout(row, 1em, $center: true);
+
font-size: 0.8em;
text-decoration: none;
color: #55a;
.right-column__project-details-url-icon {
- width: 1em;
- height: 1em;
+ width: 1.2em;
+ height: 1.2em;
object-fit: contain;
}
}
@@ -262,13 +266,15 @@
margin-bottom: 1em;
.right-column__highlight-details-url {
+ @include linear-layout(row, 1em, $center: true);
+
font-size: 0.8em;
text-decoration: none;
color: #55a;
.right-column__highlight-details-url-icon {
- width: 1em;
- height: 1em;
+ width: 1.2em;
+ height: 1.2em;
object-fit: contain;
}
}