From c76651e84106effb29b05a822cfa883835a17d82 Mon Sep 17 00:00:00 2001
From: Szymon Kin <68154191+hoolek77@users.noreply.github.com>
Date: Sun, 30 Oct 2022 10:29:01 +0100
Subject: [PATCH] Create skills section (#67)
---
src/components/atoms/tag.astro | 10 +-
.../organisms/levelled-skill-subsection.astro | 15 ++
.../organisms/skill-subsection.astro | 33 ++++
src/components/organisms/skill.astro | 4 +-
.../organisms/tag-skill-subsection.astro | 28 +++
src/components/sections/main-section.astro | 8 +-
src/components/sections/skills-section.astro | 14 +-
src/pages/index.astro | 22 +--
src/pages/playground/skills-section.astro | 160 ++++++++++++++++++
src/pages/playground/tag.astro | 2 +-
src/types/skills-section.ts | 2 +-
11 files changed, 276 insertions(+), 22 deletions(-)
create mode 100644 src/components/organisms/levelled-skill-subsection.astro
create mode 100644 src/components/organisms/skill-subsection.astro
create mode 100644 src/components/organisms/tag-skill-subsection.astro
create mode 100644 src/pages/playground/skills-section.astro
diff --git a/src/components/atoms/tag.astro b/src/components/atoms/tag.astro
index 7557735..7d7cb87 100644
--- a/src/components/atoms/tag.astro
+++ b/src/components/atoms/tag.astro
@@ -4,16 +4,14 @@ import type { IconName } from '@/types/icon';
import Icon from './icon';
export interface Props {
- icon?: {
- name: IconName;
- color?: string;
- };
+ name?: IconName;
+ color?: string;
}
-const { icon } = Astro.props;
+const { name, color } = Astro.props;
---
- {icon && }
+
diff --git a/src/components/organisms/levelled-skill-subsection.astro b/src/components/organisms/levelled-skill-subsection.astro
new file mode 100644
index 0000000..91f30a3
--- /dev/null
+++ b/src/components/organisms/levelled-skill-subsection.astro
@@ -0,0 +1,15 @@
+---
+import type { LevelledSkill } from '@/types/skills-section';
+
+import Skill from './skill.astro';
+
+export interface Props {
+ skills: LevelledSkill[];
+}
+
+const { skills } = Astro.props;
+---
+
+
+ {skills.map((skill) => )}
+
diff --git a/src/components/organisms/skill-subsection.astro b/src/components/organisms/skill-subsection.astro
new file mode 100644
index 0000000..db2915c
--- /dev/null
+++ b/src/components/organisms/skill-subsection.astro
@@ -0,0 +1,33 @@
+---
+import Typography from '@/atoms/typography.astro';
+import type { Tag } from '@/types/common';
+import type { LevelledSkill, SkillSet } from '@/types/skills-section';
+
+import LevelledSkillSubsection from './levelled-skill-subsection.astro';
+import TagSkillSubsection from './tag-skill-subsection.astro';
+
+export interface Props {
+ skillSet: SkillSet | SkillSet;
+}
+
+const {
+ skillSet: { skills, title },
+} = Astro.props;
+
+const isLevelledSkillSection = (skillsSectionData: Tag[] | LevelledSkill[]): skillsSectionData is LevelledSkill[] => {
+ if (!skillsSectionData[0]) return false;
+
+ return (skillsSectionData[0] as LevelledSkill).level !== undefined;
+};
+---
+
+
+ {title}
+ {
+ isLevelledSkillSection(skills) ? (
+
+ ) : (
+
+ )
+ }
+
diff --git a/src/components/organisms/skill.astro b/src/components/organisms/skill.astro
index fad0e6a..f6ab60a 100644
--- a/src/components/organisms/skill.astro
+++ b/src/components/organisms/skill.astro
@@ -18,7 +18,9 @@ const IconWrapper = url ? 'a' : 'div';
{...(url && { href: url, target: "_blank", rel: "noopener noreferrer" })}
>
- {name}
+
+ {name}
+
diff --git a/src/components/organisms/tag-skill-subsection.astro b/src/components/organisms/tag-skill-subsection.astro
new file mode 100644
index 0000000..335a955
--- /dev/null
+++ b/src/components/organisms/tag-skill-subsection.astro
@@ -0,0 +1,28 @@
+---
+import Tag from '@/atoms/tag.astro';
+import type { Tag as TagData } from '@/types/common';
+
+export interface Props {
+ skills: TagData[];
+}
+
+const { skills } = Astro.props;
+---
+
+
+ {
+ skills.map(({ name, icon, iconColor, url }) =>
+ url ? (
+
+
+ {name}
+
+
+ ) : (
+
+ {name}
+
+ )
+ )
+ }
+
diff --git a/src/components/sections/main-section.astro b/src/components/sections/main-section.astro
index b969baa..f88bd1d 100644
--- a/src/components/sections/main-section.astro
+++ b/src/components/sections/main-section.astro
@@ -68,10 +68,14 @@ const {
tags.map(({ icon, iconColor, name, url: tagUrl }) =>
tagUrl ? (
- {name}
+
+ {name}
+
) : (
- {name}
+
+ {name}
+
)
)
}
diff --git a/src/components/sections/skills-section.astro b/src/components/sections/skills-section.astro
index 02cebdc..13a3eed 100644
--- a/src/components/sections/skills-section.astro
+++ b/src/components/sections/skills-section.astro
@@ -1,8 +1,20 @@
---
import SectionCard from '@/atoms/section-card.astro';
+import Typography from '@/atoms/typography.astro';
+import SkillSubsection from '@/organisms/skill-subsection.astro';
import type { SkillsSection } from '@/types/skills-section';
export interface Props extends SkillsSection {}
+
+const {
+ config: { title },
+ skillSets,
+} = Astro.props;
---
-Skills section
+
+ {title}
+
+ {skillSets.map((skillSet) => )}
+
+
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 788fccb..93666bb 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -22,8 +22,18 @@ import data from '../data';
-