Update components folder structure to be section-based (#143)

This commit is contained in:
Konrad Szwarc 2023-01-13 21:19:11 +01:00 committed by GitHub
parent b826372fbc
commit d0146bb384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 99 additions and 96 deletions

View file

@ -84,7 +84,8 @@
// Imports and exports order. // Imports and exports order.
"simple-import-sort/imports": 2, "simple-import-sort/imports": 2,
"simple-import-sort/exports": 2 "simple-import-sort/exports": 2,
"import/order": 0
} }
} }
] ]

View file

@ -1,7 +1,8 @@
--- ---
import Icon from '@/atoms/icon';
import type { IconName } from '@/types/icon'; import type { IconName } from '@/types/icon';
import Icon from './icon';
type IconButtonSize = 'small' | 'large'; type IconButtonSize = 'small' | 'large';
export interface Props { export interface Props {

View file

@ -1,5 +1,4 @@
import type { IconProps } from './icon'; import Icon, { IconProps } from './icon';
import Icon from './icon';
import Tooltip, { TooltipProps } from './tooltip'; import Tooltip, { TooltipProps } from './tooltip';
type Props = IconProps & Omit<TooltipProps, 'children'>; type Props = IconProps & Omit<TooltipProps, 'children'>;

View file

@ -1,9 +1,9 @@
import { useLocation } from 'react-use'; import { useLocation } from 'react-use';
import Icon from '@/atoms/icon';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { IconName } from '@/types/icon'; import type { IconName } from '@/types/icon';
import Icon from './icon';
import Tooltip from './tooltip'; import Tooltip from './tooltip';
export interface SidebarItemProps { export interface SidebarItemProps {

View file

@ -1,7 +1,8 @@
--- ---
import Icon from '@/atoms/icon';
import type { IconName } from '@/types/icon'; import type { IconName } from '@/types/icon';
import Icon from './icon';
export interface Props { export interface Props {
name?: IconName; name?: IconName;
color?: string; color?: string;

View file

@ -1,7 +1,8 @@
--- ---
import TagComponent from '@/atoms/tag.astro';
import type { Tag } from '@/types/common'; import type { Tag } from '@/types/common';
import TagComponent from './tag.astro';
export interface Props { export interface Props {
tags: Tag[]; tags: Tag[];
} }

View file

@ -1,5 +1,5 @@
--- ---
import Typography from '@/atoms/typography.astro'; import Typography from './typography.astro';
export interface Props { export interface Props {
startDate: Date; startDate: Date;

View file

@ -1,5 +1,5 @@
--- ---
import Button from '@/atoms/button.astro'; import Button from '@/components/button.astro';
--- ---
<div class="p-5"> <div class="p-5">

View file

@ -1,9 +1,9 @@
--- ---
import BookTile from '@/atoms/book-tile.astro'; import Typography from '@/components/typography.astro';
import MediaTile from '@/atoms/media-tile.astro'; import BookTile from '@/sections/favorites/book-tile.astro';
import PersonTile from '@/atoms/person-tile.astro'; import MediaTile from '@/sections/favorites/media-tile.astro';
import Typography from '@/atoms/typography.astro'; import PersonTile from '@/sections/favorites/person-tile.astro';
import VideoTile from '@/atoms/video-tile.astro'; import VideoTile from '@/sections/favorites/video-tile.astro';
import type { Book, Media, Person, Video } from '@/types/favorites-section'; import type { Book, Media, Person, Video } from '@/types/favorites-section';
const book: Book = { const book: Book = {

View file

@ -1,5 +1,5 @@
--- ---
import IconButton from '@/atoms/icon-button.astro'; import IconButton from '@/components/icon-button.astro';
--- ---
<div class="flex flex-col gap-2 p-5"> <div class="flex flex-col gap-2 p-5">

View file

@ -1,5 +1,5 @@
--- ---
import Icon from '@/atoms/icon'; import Icon from '@/components/icon';
--- ---
<div class="p-5"> <div class="p-5">

View file

@ -1,5 +1,5 @@
--- ---
import LabelledValue from '@/atoms/labelled-value.astro'; import LabelledValue from '@/components/labelled-value.astro';
--- ---
<div class="p-5"> <div class="p-5">

View file

@ -1,8 +1,12 @@
--- ---
import MainSection from '@/sections/main-section.astro'; import MainSection from '@/sections/main/main-section.astro';
import type { MainSection as MainSectionData } from '@/types/main-section'; import type { MainSection as MainSectionData } from '@/types/main-section';
const mainSectionData: MainSectionData = { const mainSectionData: MainSectionData = {
config: {
icon: 'fa6-solid:user',
title: 'About me',
},
image: import('@/assets/my-image.jpeg'), image: import('@/assets/my-image.jpeg'),
fullName: 'Mark Freeman', fullName: 'Mark Freeman',
role: 'Senior React Developer', role: 'Senior React Developer',

View file

@ -1,5 +1,5 @@
--- ---
import ProjectTimelineItem from '@/organisms/project-timeline-item.astro'; import ProjectTimelineItem from '@/sections/portfolio/project-timeline-item.astro';
import type { I18n } from '@/types/i18n'; import type { I18n } from '@/types/i18n';
import type { Project } from '@/types/portfolio-section'; import type { Project } from '@/types/portfolio-section';

View file

@ -1,7 +1,7 @@
--- ---
import SectionCard from '@/atoms/section-card.astro'; import SectionCard from '@/components/section-card.astro';
--- ---
<div class="p-5"> <div class="p-5">
<SectionCard>SectionCard text</SectionCard> <SectionCard section="main">SectionCard text</SectionCard>
</div> </div>

View file

@ -1,5 +1,5 @@
--- ---
import SidebarItem from '@/atoms/sidebar-item'; import SidebarItem from '@/components/sidebar-item';
--- ---
<div class="p-5"> <div class="p-5">

View file

@ -1,6 +1,6 @@
--- ---
import SidebarItem from '@/atoms/sidebar-item'; import Sidebar from '@/components/sidebar.astro';
import Sidebar from '@/organisms/sidebar.astro'; import SidebarItem from '@/components/sidebar-item';
--- ---
<div class="relative p-5"> <div class="relative p-5">

View file

@ -1,5 +1,5 @@
--- ---
import Skill from '@/organisms/skill.astro'; import Skill from '@/sections/skills/skill.astro';
import type { LevelledSkill } from '@/types/skills-section'; import type { LevelledSkill } from '@/types/skills-section';
const levelledSkill: LevelledSkill = { const levelledSkill: LevelledSkill = {

View file

@ -1,5 +1,5 @@
--- ---
import SkillsSection from '@/sections/skills-section.astro'; import SkillsSection from '@/sections/skills/skills-section.astro';
import type { SkillsSection as SkillsSectionData } from '@/types/skills-section'; import type { SkillsSection as SkillsSectionData } from '@/types/skills-section';
const skills: SkillsSectionData = { const skills: SkillsSectionData = {

View file

@ -1,5 +1,5 @@
--- ---
import Tag from '@/atoms/tag.astro'; import Tag from '@/components/tag.astro';
--- ---
<div class="p-5"> <div class="p-5">

View file

@ -1,5 +1,5 @@
--- ---
import Testimonial from '@/organisms/testimonial.astro'; import Testimonial from '@/sections/testimonials/testimonial.astro';
import type { Testimonial as TestimonialData } from '@/types/testimonials-section'; import type { Testimonial as TestimonialData } from '@/types/testimonials-section';
const testimonial: TestimonialData = { const testimonial: TestimonialData = {

View file

@ -1,5 +1,5 @@
--- ---
import TestimonialsSection from '@/sections/testimonials-section.astro'; import TestimonialsSection from '@/sections/testimonials/testimonials-section.astro';
import type { Testimonial } from '@/types/testimonials-section'; import type { Testimonial } from '@/types/testimonials-section';
const testimonials: Testimonial[] = [ const testimonials: Testimonial[] = [

View file

@ -1,5 +1,5 @@
--- ---
import Typography from '@/atoms/typography.astro'; import Typography from '@/components/typography.astro';
const text = 'A quick brown fox jumps over the lazy dog'; const text = 'A quick brown fox jumps over the lazy dog';
--- ---

View file

@ -1,5 +1,5 @@
--- ---
import WorkTimelineItem from '@/organisms/work-timeline-item.astro'; import WorkTimelineItem from '@/sections/experience/work-timeline-item.astro';
import type { Job } from '@/types/experience-section'; import type { Job } from '@/types/experience-section';
import type { I18n } from '@/types/i18n'; import type { I18n } from '@/types/i18n';

View file

@ -1,13 +1,13 @@
--- ---
import SidebarItem from '@/atoms/sidebar-item'; import Sidebar from '@/components/sidebar.astro';
import ThemeToggle from '@/atoms/theme-icon'; import SidebarItem from '@/components/sidebar-item';
import Sidebar from '@/organisms/sidebar.astro'; import ThemeToggle from '@/components/theme-icon';
import ExperienceSection from '@/sections/experience-section.astro'; import ExperienceSection from '@/sections/experience/experience-section.astro';
import FavoritesSection from '@/sections/favorites-section.astro'; import FavoritesSection from '@/sections/favorites/favorites-section.astro';
import MainSection from '@/sections/main-section.astro'; import MainSection from '@/sections/main/main-section.astro';
import PortfolioSection from '@/sections/portfolio-section.astro'; import PortfolioSection from '@/sections/portfolio/portfolio-section.astro';
import SkillsSection from '@/sections/skills-section.astro'; import SkillsSection from '@/sections/skills/skills-section.astro';
import TestimonialsSection from '@/sections/testimonials-section.astro'; import TestimonialsSection from '@/sections/testimonials/testimonials-section.astro';
import getObjectKeys from '@/utils/getObjectKeys'; import getObjectKeys from '@/utils/getObjectKeys';
import data from '../data'; import data from '../data';

View file

@ -1,13 +1,14 @@
--- ---
import DividedList from '@/atoms/divided-list.astro'; import DividedList from '@/components/divided-list.astro';
import Divider from '@/atoms/divider.astro'; import Divider from '@/components/divider.astro';
import SectionCard from '@/atoms/section-card.astro'; import SectionCard from '@/components/section-card.astro';
import WorkTimelineItem from '@/organisms/work-timeline-item.astro';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { ExperienceSection, Job } from '@/types/experience-section'; import type { ExperienceSection, Job } from '@/types/experience-section';
import type { I18n } from '@/types/i18n'; import type { I18n } from '@/types/i18n';
import removeLast from '@/utils/remove-last'; import removeLast from '@/utils/remove-last';
import WorkTimelineItem from './work-timeline-item.astro';
export interface Props extends ExperienceSection { export interface Props extends ExperienceSection {
jobs: Job[]; jobs: Job[];
i18n: I18n; i18n: I18n;

View file

@ -1,12 +1,11 @@
--- ---
import IconButton from '@/atoms/icon-button.astro'; import IconButton from '@/components/icon-button.astro';
import Timestamp from '@/atoms/timestamp.astro'; import TagsList from '@/components/tags-list.astro';
import Typography from '@/atoms/typography.astro'; import Timestamp from '@/components/timestamp.astro';
import Typography from '@/components/typography.astro';
import type { Job } from '@/types/experience-section'; import type { Job } from '@/types/experience-section';
import type { I18n } from '@/types/i18n'; import type { I18n } from '@/types/i18n';
import TagsList from '../molecules/tags-list.astro';
export interface Props { export interface Props {
job: Job; job: Job;
i18n: I18n; i18n: I18n;

View file

@ -1,7 +1,7 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import Typography from '@/atoms/typography.astro'; import Typography from '@/components/typography.astro';
import type { Book } from '@/types/favorites-section'; import type { Book } from '@/types/favorites-section';
export interface Props { export interface Props {

View file

@ -1,15 +1,16 @@
--- ---
import type { ComponentInstance } from 'astro'; import type { ComponentInstance } from 'astro';
import BookTile from '@/atoms/book-tile.astro'; import SectionCard from '@/components/section-card.astro';
import MediaTile from '@/atoms/media-tile.astro'; import Typography from '@/components/typography.astro';
import PersonTile from '@/atoms/person-tile.astro';
import SectionCard from '@/atoms/section-card.astro';
import Typography from '@/atoms/typography.astro';
import VideoTile from '@/atoms/video-tile.astro';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { Book, FavoritesSection, Media, Person, Video } from '@/types/favorites-section'; import type { Book, FavoritesSection, Media, Person, Video } from '@/types/favorites-section';
import BookTile from './book-tile.astro';
import MediaTile from './media-tile.astro';
import PersonTile from './person-tile.astro';
import VideoTile from './video-tile.astro';
export interface Props extends FavoritesSection {} export interface Props extends FavoritesSection {}
const { const {

View file

@ -1,7 +1,7 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import Typography from '@/atoms/typography.astro'; import Typography from '@/components/typography.astro';
import type { Media } from '@/types/favorites-section'; import type { Media } from '@/types/favorites-section';
export interface Props { export interface Props {

View file

@ -1,7 +1,7 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import Typography from '@/atoms/typography.astro'; import Typography from '@/components/typography.astro';
import type { Person } from '@/types/favorites-section'; import type { Person } from '@/types/favorites-section';
export interface Props { export interface Props {

View file

@ -1,7 +1,7 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import Typography from '@/atoms/typography.astro'; import Typography from '@/components/typography.astro';
import type { Video } from '@/types/favorites-section'; import type { Video } from '@/types/favorites-section';
export interface Props { export interface Props {

View file

@ -1,15 +1,14 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import Button from '@/atoms/button.astro'; import Button from '@/components/button.astro';
import IconButton from '@/atoms/icon-button.astro'; import IconButton from '@/components/icon-button.astro';
import SectionCard from '@/atoms/section-card.astro'; import SectionCard from '@/components/section-card.astro';
import Typography from '@/atoms/typography.astro'; import TagsList from '@/components/tags-list.astro';
import Typography from '@/components/typography.astro';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { MainSection } from '@/types/main-section'; import type { MainSection } from '@/types/main-section';
import TagsList from '../molecules/tags-list.astro';
export interface Props extends MainSection {} export interface Props extends MainSection {}
const { const {

View file

@ -1,13 +1,14 @@
--- ---
import DividedList from '@/atoms/divided-list.astro'; import DividedList from '@/components/divided-list.astro';
import Divider from '@/atoms/divider.astro'; import Divider from '@/components/divider.astro';
import SectionCard from '@/atoms/section-card.astro'; import SectionCard from '@/components/section-card.astro';
import ProjectTimelineItem from '@/organisms/project-timeline-item.astro';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { I18n } from '@/types/i18n'; import type { I18n } from '@/types/i18n';
import type { PortfolioSection } from '@/types/portfolio-section'; import type { PortfolioSection } from '@/types/portfolio-section';
import removeLast from '@/utils/remove-last'; import removeLast from '@/utils/remove-last';
import ProjectTimelineItem from './project-timeline-item.astro';
export interface Props extends PortfolioSection { export interface Props extends PortfolioSection {
i18n: I18n; i18n: I18n;
} }

View file

@ -1,15 +1,14 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import IconButton from '@/atoms/icon-button.astro'; import IconButton from '@/components/icon-button.astro';
import LabelledValue from '@/atoms/labelled-value.astro'; import LabelledValue from '@/components/labelled-value.astro';
import Timestamp from '@/atoms/timestamp.astro'; import TagsList from '@/components/tags-list.astro';
import Typography from '@/atoms/typography.astro'; import Timestamp from '@/components/timestamp.astro';
import Typography from '@/components/typography.astro';
import type { I18n } from '@/types/i18n'; import type { I18n } from '@/types/i18n';
import type { Project } from '@/types/portfolio-section'; import type { Project } from '@/types/portfolio-section';
import TagsList from '../molecules/tags-list.astro';
export interface Props { export interface Props {
project: Project; project: Project;
i18n: I18n; i18n: I18n;

View file

@ -1,5 +1,5 @@
--- ---
import SkillLevelTile from '@/atoms/skill-level-tile.astro'; import SkillLevelTile from './skill-level-tile.astro';
export interface Props { export interface Props {
skillLevel: number; skillLevel: number;

View file

@ -1,9 +1,9 @@
--- ---
import Typography from '@/atoms/typography.astro'; import TagsList from '@/components/tags-list.astro';
import Typography from '@/components/typography.astro';
import type { Tag } from '@/types/common'; import type { Tag } from '@/types/common';
import type { LevelledSkill, SkillSet } from '@/types/skills-section'; import type { LevelledSkill, SkillSet } from '@/types/skills-section';
import TagsList from '../molecules/tags-list.astro';
import LevelledSkillSubsection from './levelled-skill-subsection.astro'; import LevelledSkillSubsection from './levelled-skill-subsection.astro';
export interface Props { export interface Props {

View file

@ -1,10 +1,10 @@
--- ---
import Icon from '@/atoms/icon'; import IconWithTooltip from '@/components/icon-with-tooltip';
import IconWithTooltip from '@/atoms/icon-with-tooltip'; import Typography from '@/components/typography.astro';
import Typography from '@/atoms/typography.astro';
import type { IconName } from '@/types/icon'; import type { IconName } from '@/types/icon';
import type { LevelledSkill } from '@/types/skills-section'; import type { LevelledSkill } from '@/types/skills-section';
import Icon from '../../components/icon';
import SkillLevel from './skill-level.astro'; import SkillLevel from './skill-level.astro';
export interface Props extends LevelledSkill {} export interface Props extends LevelledSkill {}

View file

@ -1,9 +1,10 @@
--- ---
import SectionCard from '@/atoms/section-card.astro'; import SectionCard from '@/components/section-card.astro';
import SkillSubsection from '@/organisms/skill-subsection.astro';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { SkillsSection } from '@/types/skills-section'; import type { SkillsSection } from '@/types/skills-section';
import SkillSubsection from './skill-subsection.astro';
export interface Props extends SkillsSection {} export interface Props extends SkillsSection {}
const { const {

View file

@ -1,8 +1,8 @@
--- ---
import { Image } from '@astrojs/image/components'; import { Image } from '@astrojs/image/components';
import IconButton from '@/atoms/icon-button.astro'; import IconButton from '@/components/icon-button.astro';
import Typography from '@/atoms/typography.astro'; import Typography from '@/components/typography.astro';
import type { Testimonial } from '@/types/testimonials-section'; import type { Testimonial } from '@/types/testimonials-section';
export interface Props { export interface Props {

View file

@ -1,12 +1,13 @@
--- ---
import DividedList from '@/atoms/divided-list.astro'; import DividedList from '@/components/divided-list.astro';
import Divider from '@/atoms/divider.astro'; import Divider from '@/components/divider.astro';
import SectionCard from '@/atoms/section-card.astro'; import SectionCard from '@/components/section-card.astro';
import Testimonial from '@/organisms/testimonial.astro';
import type { Section } from '@/types/data'; import type { Section } from '@/types/data';
import type { TestimonialsSection } from '@/types/testimonials-section'; import type { TestimonialsSection } from '@/types/testimonials-section';
import removeLast from '@/utils/remove-last'; import removeLast from '@/utils/remove-last';
import Testimonial from './testimonial.astro';
export interface Props extends TestimonialsSection {} export interface Props extends TestimonialsSection {}
const { const {

View file

@ -32,13 +32,7 @@
// Add aliases for common paths. // Add aliases for common paths.
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/atoms/*": ["src/components/atoms/*"], "@/*": ["src/*"]
"@/organisms/*": ["src/components/organisms/*"],
"@/sections/*": ["src/components/sections/*"],
"@/assets/*": ["src/assets/*"],
"@/types/*": ["src/types/*"],
"@/constants/*": ["src/constants/*"],
"@/utils/*": ["src/utils/*"]
} }
}, },
"include": ["**/*.ts", "**/*.tsx", "**/*.cjs", "**/*.astro"] "include": ["**/*.ts", "**/*.tsx", "**/*.cjs", "**/*.astro"]