diff --git a/src/pages/samples/components.tsx b/src/pages/samples/components.tsx deleted file mode 100644 index 5f38d77..0000000 --- a/src/pages/samples/components.tsx +++ /dev/null @@ -1,490 +0,0 @@ -// !STARTERCONF You can delete this page -import clsx from 'clsx'; -import * as React from 'react'; -import { - HiArrowRight, - HiOutlineCreditCard, - HiOutlineDesktopComputer, - HiOutlineDeviceMobile, - HiOutlineShieldCheck, - HiPlus, -} from 'react-icons/hi'; - -import Button from '@/components/buttons/Button'; -import IconButton from '@/components/buttons/IconButton'; -import TextButton from '@/components/buttons/TextButton'; -import ArrowLink from '@/components/links/ArrowLink'; -import ButtonLink from '@/components/links/ButtonLink'; -import PrimaryLink from '@/components/links/PrimaryLink'; -import UnderlineLink from '@/components/links/UnderlineLink'; -import UnstyledLink from '@/components/links/UnstyledLink'; -import NextImage from '@/components/NextImage'; -import Seo from '@/components/Seo'; -import Skeleton from '@/components/Skeleton'; - -type Color = (typeof colorList)[number]; - -export default function ComponentsPage() { - const [mode, setMode] = React.useState<'dark' | 'light'>('light'); - const [color, setColor] = React.useState('blue'); - function toggleMode() { - return mode === 'dark' ? setMode('light') : setMode('dark'); - } - - const textColor = mode === 'dark' ? 'text-gray-300' : 'text-gray-600'; - - return ( - <> - - -
-
-
-

Built-in Components

- - Back to Home - - -
- - {/* */} -
- -
    -
  1. -

    Customize Colors

    -

    - You can change primary color to any Tailwind CSS colors. See - globals.css to change your color. -

    -
    - - - Check list of colors - -
    -
    -
    - 50 -
    -
    - 100 -
    -
    - 200 -
    -
    - 300 -
    -
    - 400 -
    -
    - 500 -
    -
    - 600 -
    -
    - 700 -
    -
    - 800 -
    -
    - 900 -
    -
    - 950 -
    -
    -
  2. -
  3. -

    UnstyledLink

    -

    - No style applied, differentiate internal and outside links, - give custom cursor for outside links. -

    -
    - Internal Links - - Outside Links - -
    -
  4. -
  5. -

    PrimaryLink

    -

    - Add styling on top of UnstyledLink, giving a primary color to - the link. -

    -
    - Internal Links - - Outside Links - -
    -
  6. -
  7. -

    UnderlineLink

    -

    - Add styling on top of UnstyledLink, giving a dotted and - animated underline. -

    -
    - Internal Links - - Outside Links - -
    -
  8. -
  9. -

    ArrowLink

    -

    - Useful for indicating navigation, I use this quite a lot, so - why not build a component with some whimsy touch? -

    -
    - - Direction Left - - Direction Right - - Polymorphic - - - Polymorphic - -
    -
  10. -
  11. -

    ButtonLink

    -

    - Button styled link with 3 variants. -

    -
    - - Primary Variant - - - Outline Variant - - - Ghost Variant - - - Dark Variant - - - Light Variant - -
    -
  12. -
  13. -

    Button

    -

    - Ordinary button with style. -

    -
    - - - - - -
    -
    - - - - - -
    -
    - - - - - -
    -
    - - - - - - -
    - -
    - - - - - -
    -
    - - - - - -
    -
  14. -
  15. -

    TextButton

    -

    - Button with a text style -

    -
    - Primary Variant - Basic Variant -
    -
  16. -
  17. -

    IconButton

    -

    - Button with only icon inside -

    -
    - - - - - -
    -
  18. -
  19. -

    Custom 404 Page

    -

    - Styled 404 page with some animation. -

    -
    - Visit the 404 page -
    -
  20. -
  21. -

    Next Image

    -

    - Next Image with default props and skeleton animation -

    - -
  22. -
  23. -

    Skeleton

    -

    - Skeleton with shimmer effect -

    - -
  24. -
-
-
-
- - ); -} - -const colorList = [ - 'slate', - 'gray', - 'zinc', - 'neutral', - 'stone', - 'red', - 'orange', - 'amber', - 'yellow', - 'lime', - 'green', - 'emerald', - 'teal', - 'cyan', - 'sky', - 'blue', - 'indigo', - 'violet', - 'purple', - 'fuchsia', - 'pink', - 'rose', -] as const; diff --git a/src/queries/projects.ts b/src/queries/projects.ts index 9f68c1e..ce3467f 100644 --- a/src/queries/projects.ts +++ b/src/queries/projects.ts @@ -1,4 +1,4 @@ -import { gql } from '@apollo/client'; +import { ApolloError, gql } from '@apollo/client'; import { flattenToArray } from '@/lib/graphqlUtils'; @@ -7,27 +7,38 @@ import apolloClient from '../../apollo/apollo-client'; import { Project, RawProject } from '@/types/Project'; export async function queryProjects() { - const { data } = await apolloClient.query({ query: projectsQuery }); - - const result: RawProject[] = flattenToArray(data.projects); - const projects: Project[] = []; - - result.map((entry) => { - const project: Project = { - id: entry.id, - title: entry.title, - image: entry.image, - shortDescription: entry.shortDescription, - longDescription: entry.longDescription, - tools: entry.tools.split(','), - date: entry.date, - tags: entry.tags.split(','), - links: entry.links, - }; - projects.push(project); - }); - - return projects; + try { + const { data } = await apolloClient.query({ query: projectsQuery }); + + const result: RawProject[] = flattenToArray(data.projects); + const projects: Project[] = []; + + result.map((entry) => { + const project: Project = { + id: entry.id, + title: entry.title, + image: entry.image, + shortDescription: entry.shortDescription, + longDescription: entry.longDescription, + tools: entry.tools.split(','), + date: entry.date, + tags: entry.tags.split(','), + links: entry.links, + }; + projects.push(project); + }); + + return projects; + } catch (error) { + if (error instanceof ApolloError) { + // eslint-disable-next-line no-console + console.error('Apollo Client Error:', error.message); + } else { + // eslint-disable-next-line no-console + console.error('An unexpected error occurred:', error); + } + return []; + } } const projectsQuery = gql`