diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/PortfolioProject.astro | 84 | ||||
| -rw-r--r-- | src/components/TechnologyBadge.astro | 143 |
2 files changed, 227 insertions, 0 deletions
diff --git a/src/components/PortfolioProject.astro b/src/components/PortfolioProject.astro new file mode 100644 index 0000000..b3483e9 --- /dev/null +++ b/src/components/PortfolioProject.astro @@ -0,0 +1,84 @@ +--- +import { Icon } from "astro-icon/components"; +import TechnologyBadge from "./TechnologyBadge.astro"; + +interface Props { + title: string; + summary: string; + tags: string[]; + + detailsLink?: string; + githubLink?: string; + onlineLink?: string; +} + +const { title, summary, tags, detailsLink, githubLink, onlineLink } = + Astro.props; +--- + +<article> + <h3>{title}</h3> + + <p>{summary}</p> + + <div> + {detailsLink && <a href={detailsLink}> + <Icon name="tabler:info-circle"/> + Detalles + </a>} + + {githubLink && <a href={githubLink}> + <Icon name="tabler:brand-github"/> + GitHub + </a>} + + {onlineLink && <a href={onlineLink}> + <Icon name="tabler:link"/> + En lĂnea + </a>} + </div> + + <div> + {tags.map(tag => ( + <TechnologyBadge code={tag} /> + ))} + </div> +</article> + +<style lang="scss"> + @use "../../styles/variables" as *; + + h3, p, div, a { + margin: 0; + } + + article { + display: flex; + flex-direction: column; + justify-content: start; + gap: 0.75rem; + + padding: 1.5rem 1rem; + border-radius: 0.5rem; + + background-color: white; + border: 1px solid $accent; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + } + + a { + display: inline-flex; + align-items: center; + gap: 0.5rem; + color: var(--text); + text-decoration: none; + } + + div *:not(:last-child) { + margin-inline-end: 0.5rem; + } + + div:nth-last-child(1) { + margin-block-start: 0.5rem;; + } +</style> diff --git a/src/components/TechnologyBadge.astro b/src/components/TechnologyBadge.astro new file mode 100644 index 0000000..83d0d40 --- /dev/null +++ b/src/components/TechnologyBadge.astro @@ -0,0 +1,143 @@ +--- +import Icon from "node_modules/astro-icon/components/Icon.astro"; + +interface Technology { + name: string; + colour: string; + text?: "light" | "dark"; + icon?: string; +} + +export const technologies: { [key: string]: Technology } = { + java: { + name: "Java", + colour: "#e76f00", + icon: "coffee" + }, + dotnet: { + name: ".NET", + colour: "#512bd4", + icon: "brand-c-sharp", + }, + go: { + name: "Go", + colour: "#00add8", + icon: "brand-golang", + }, + mysql: { + name: "MySQL", + colour: "#3a75b0", + icon: "brand-mysql", + }, + php: { + name: "PHP", + colour: "#8892be", + icon: "brand-php", + }, + python: { + name: "Python", + colour: "#306998", + }, + typescript: { + name: "TypeScript", + colour: "#007acc", + icon: "brand-typescript", + }, + azure: { + name: "Azure", + colour: "#0089d6", + icon: "brand-azure", + }, + ubuntu: { + name: "Ubuntu", + colour: "#E95420", + icon: "brand-ubuntu", + }, + windows: { + name: "Windows", + colour: "#0078d6", + icon: "brand-windows", + }, + astro: { + name: "Astro", + colour: "#3d50f5", + icon: "brand-astro", + }, + wordpress: { + name: "WordPress", + colour: "#21759b", + icon: "brand-wordpress", + }, + github: { + name: "GitHub", + colour: "#181717", + text: "light", + icon: "brand-github", + }, + web: { + name: "Web", + colour: "#f7df1e", + text: "dark", + icon: "world", + }, +}; + +interface Props { + // tech must be name of the key of one of the technologies + code: string; + + size?: "small" | "large"; +} + +const { code, size } = Astro.props; +if (!(code in technologies)) { + throw new Error(`Technology code "${code}" is not defined in technologies.`); +} +const tech = technologies[code] as Technology; +--- + +<span class={`pill-${size ?? "small"} text-${tech.text ?? "light"}`}> + { + tech.icon && ( + <Icon name={`tabler:${tech.icon}`} /> + ) + } + {tech.name} +</span> + +<style define:vars={{ colour: tech.colour }}> + span { + /*display: inline-block;*/ + background-color: var(--colour); + font-weight: bold; + text-transform: uppercase; + border-radius: 0.5em; + padding: 0.5em 1em; + + display: inline-flex; + align-items: center; + gap: 0.5rem; + } + + .text-dark { + color: #000; + } + + .text-light { + color: #fff; + } + + .pill-small { + padding: 0.35em 0.5em; + border-radius: 0.25em; + + font-size: 0.75em; + } + + .pill-large { + padding: 0.35 0.75em; + border-radius: 0.5em; + + font-size: 0.75em; + } +</style> |
