Skip to content

Commit

Permalink
feat: updated project type to work with all history items
Browse files Browse the repository at this point in the history
  • Loading branch information
schaechinger committed Sep 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5c44b09 commit 49003ec
Showing 11 changed files with 56 additions and 39 deletions.
10 changes: 5 additions & 5 deletions app/brandbook/page.tsx
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import MessageBanner from '@components/molecules/MessageBanner';

import SplitSection from './SplitSection';
import TechItem from '../components/atoms/TechItem';
import ProjectTypeLabel from '../components/atoms/ProjectTypeLabel';
import HistoryItemTypeLabel from '../components/atoms/HistoryItemTypeLabel';

export const metadata: Metadata = {
title: 'Brandbook – Manuel Schächinger',
@@ -80,10 +80,10 @@ const BrandBook = () => {

<SplitSection id="project-types" label="Project Types">
<ul className="flex flex-col gap-2">
<li><ProjectTypeLabel type="founder" label colored /></li>
<li><ProjectTypeLabel type="freelance" label /></li>
<li><ProjectTypeLabel type="private" colored /></li>
<li><ProjectTypeLabel type="employee" /></li>
<li><HistoryItemTypeLabel type="founder" label colored /></li>
<li><HistoryItemTypeLabel type="freelance" label /></li>
<li><HistoryItemTypeLabel type="private" colored /></li>
<li><HistoryItemTypeLabel type="employee" /></li>
</ul>
</SplitSection>

Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import clsx from 'clsx';
import { useTranslations } from 'next-intl';

import Banknotes from '@components/icons/Banknotes';
import BuildingsCity from '@components/icons/BuildingsCity';
import Education from '@components/icons/Education';
import HeartEmpty from '@components/icons/HeartEmpty';
import Knight from '@components/icons/Knight';
import { type ProjectType } from '@models/project';
import clsx from 'clsx';
import { useTranslations } from 'next-intl';
import { type HistoryType } from '@models/history';


type Props = {
type: ProjectType;
type: HistoryType;
colored?: boolean;
label?: boolean;
}

const ProjectTypeLabel = ({ colored, label, type }: Props) => {
const t = useTranslations('pages.projects.types')
const HistoryItemTypeLabel = ({ colored, label, type }: Props) => {
const t = useTranslations('general.history.types')
const TypeIcon = {
education: Education,
employee: BuildingsCity,
founder: HeartEmpty,
freelance: Banknotes,
@@ -34,4 +37,4 @@ const ProjectTypeLabel = ({ colored, label, type }: Props) => {
);
};

export default ProjectTypeLabel;
export default HistoryItemTypeLabel;
9 changes: 9 additions & 0 deletions app/components/icons/Education.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Icon, { type IconProps } from './Icon';

const Education = (props: IconProps) => (
<Icon { ...props }>
<path id="education" d="M16.91418,20.64087,24,17.85693v5.72254a.49988.49988,0,0,1-.3205.46667l-6.782,2.60865a2.50061,2.50061,0,0,1-1.795,0l-6.782-2.60865A.49988.49988,0,0,1,8,23.57947V17.85693l7.08582,2.78394A2.50024,2.50024,0,0,0,16.91418,20.64087Zm12.76862-9.2655-12.95148-5.088a1.99981,1.99981,0,0,0-1.46264,0L2.3172,11.37537A.50014.50014,0,0,0,2,11.84082v1.31836a.50014.50014,0,0,0,.3172.46545l1.42261.559A1.98851,1.98851,0,0,0,3,15.7207v2.50147a1.003,1.003,0,0,0-1,1V24l2-1.88892L6,24V19.22217a1.003,1.003,0,0,0-1-1V15.7207l1.43506-.47827,8.83362,3.47022a1.99981,1.99981,0,0,0,1.46264,0l12.95148-5.088A.50014.50014,0,0,0,30,13.15918V11.84082A.50014.50014,0,0,0,29.6828,11.37537Z"/>
</Icon>
)

export default Education;
9 changes: 4 additions & 5 deletions app/components/molecules/HistoryItemCompany.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import CompanyLink from '@components/atoms/CompanyLink';
import ProjectTypeLabel from '@components/atoms/ProjectTypeLabel';
import type { Company } from '@models/history';
import { ProjectType } from '@models/project';
import HistoryItemTypeLabel from '@/app/components/atoms/HistoryItemTypeLabel';
import type { Company, HistoryType } from '@models/history';

type Props = {
company?: Company;
type?: ProjectType;
type?: HistoryType;
};

const HistoryItemCompany = ({ company, type }: Props) => (
(company || type) && <div className="font-thin">
{type && <ProjectTypeLabel type={type} label={!company} colored />}
{type && <HistoryItemTypeLabel type={type} label={!company} colored />}
{company && <CompanyLink company={company} />}
</div>
);
4 changes: 2 additions & 2 deletions app/components/molecules/ProjectMasterData.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { useTranslations } from 'next-intl';

import Breadcrumbs from '@components/atoms/Breadcumbs';
import CompanyLink from '@components/atoms/CompanyLink';
import ProjectTypeLabel from '@components/atoms/ProjectTypeLabel';
import HistoryItemTypeLabel from '@/app/components/atoms/HistoryItemTypeLabel';
import TechItem from '@components/atoms/TechItem';
import TimeSpan from '@components/atoms/TimeSpan';
import PageSection from '@components/organisms/PageSection';
@@ -32,7 +32,7 @@ const ProjectMasterData = ({ project }: Props) => {
</p>

<p className="mb-2">
{t('details.type')}: <ProjectTypeLabel type={project.type} colored label />
{t('details.type')}: <HistoryItemTypeLabel type={project.type} colored label />
</p>

{ project.company
2 changes: 1 addition & 1 deletion app/components/molecules/ThemeToggle.tsx
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ const ThemeToggle = ({ translations }: Props) => {
return (
<button
onClick={toggleTheme}
className="-ml-1 w-8 h-8 relative self-center flex justify-center items-center rounded-full transition-colors hover:bg-slate-800 hover:dark:bg-amber-400 dark:text-dark-50 hover:text-dark-50 hover:dark:text-dark-800 z-50"
className="-ml-1 w-8 h-8 relative self-center flex justify-center items-center rounded-full transition-colors sm:hover:bg-slate-800 sm:hover:dark:bg-amber-400 dark:text-dark-50 sm:hover:text-dark-50 sm:hover:dark:text-dark-800 z-50"
title={translations.toggle}
>
<Sun className="text-2xl absolute left-1 top-1 scale-0 dark:scale-100" />
4 changes: 2 additions & 2 deletions app/components/organisms/CareerItem.tsx
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ import HistoryItemContainer from '@components/organisms/HistoryItemContainer';
import { type CareerData } from '@models/career';

type Props = {
heading?: string;
item: CareerData;
heading?: string;
};

const CareerItem = ({ heading, item }: Props) => (
@@ -18,7 +18,7 @@ const CareerItem = ({ heading, item }: Props) => (
heading={heading}
title={item.title}
/>
<HistoryItemCompany company={item.company} />
<HistoryItemCompany company={item.company} type={item.type} />
<HistoryItemDescription description={item.description} bullets={item.bullets} />
<HistoryItemTechList tech={item.tech} />
</HistoryItemContainer>
3 changes: 3 additions & 0 deletions app/models/history.ts
Original file line number Diff line number Diff line change
@@ -15,13 +15,16 @@ export type LinkData = {
label: string;
};

export type HistoryType = 'freelance' | 'employee' | 'private' | 'founder' | 'education';

export type HistoryData = {
title: string;
slug: string;
company?: Company;
description?: string;
bullets?: string[];
tech: TechData[];
type?: HistoryType;

updatedAt?: string;
};
3 changes: 0 additions & 3 deletions app/models/project.ts
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@ import { type LocaleCode } from '@lib/router';

import type { HistoryData, LinkData } from './history';

export type ProjectType = 'freelance' | 'employee' | 'private' | 'founder';

export type ProjectLinkData = {
project?: LinkData;
code?: LinkData;
@@ -37,7 +35,6 @@ export type ProjectImage = {

export interface ProjectData extends HistoryData {
links?: ProjectLinkData;
type: ProjectType;
highlight?: boolean;
images?: ProjectImage[];
details?: ProjectDetailData;
17 changes: 10 additions & 7 deletions messages/de.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,16 @@ const general = {
address: {
germany: 'Deutschland',
},
history: {
types: {
education: 'Akademische Ausbildung',
employee: 'Angestellter',
founder: 'Gründer',
freelance: 'Freiberuflich',
private: 'Privat',
volunteer: 'Ehrenamtlich',
},
},
};

// pages
@@ -253,13 +263,6 @@ const projects = {
code: 'Den Code zum Projekt findest du auf <link></link>.',
package: 'Du kannst das Package mit <link></link> in dein Projekt einbinden.'
},
types: {
employee: 'Angestellter',
founder: 'Gründer',
freelance: 'Freiberuflich',
private: 'Privat',
volunteer: 'Ehrenamtlich',
},
};

const resume = {
17 changes: 10 additions & 7 deletions messages/en.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,16 @@ const general = {
address: {
germany: 'Germany',
},
history: {
types: {
education: 'Academic Education',
employee: 'Employee',
founder: 'Founder',
freelance: 'Freelance',
private: 'Private',
volunteer: 'Volunteer',
},
},
};

// pages
@@ -253,13 +263,6 @@ const projects = {
code: 'The source code of the project an be found at <link></link>.',
package: 'You can integrate the package using <link></link> into your project.'
},
types: {
employee: 'Employee',
founder: 'Founder',
freelance: 'Freelance',
private: 'Private',
volunteer: 'Volunteer',
},
};

const resume = {

0 comments on commit 49003ec

Please sign in to comment.