added and fixes couple of changes.

This commit is contained in:
Refansa 2023-10-27 19:32:18 +07:00
parent 4f42be666d
commit 8453777896
11 changed files with 106 additions and 52 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "portfolio", "name": "portfolio",
"version": "0.1.2", "version": "0.1.3",
"private": true, "private": true,
"author": { "author": {
"name": "Refansa", "name": "Refansa",

BIN
public/assets/project-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -0,0 +1,6 @@
import { NextResponse } from 'next/server'
import data from '../../data/projectList.json'
export async function GET() {
return NextResponse.json(data)
}

View File

@ -0,0 +1,49 @@
[
{
"title": "AmanaTax",
"description": "A video course website to learn about taxes.",
"imgSrc": "/assets/project-1.png",
"alt": "AmanaTax Homepage",
"tags": [
"internship project",
"laravel",
"completed"
]
},
{
"title": "Koperasi",
"description": "Cooperatives website that accept online transactions.",
"codeSrc": "https://github.com/Refansa/koperasi",
"imgSrc": "/assets/project-2.png",
"alt": "Koperasi Homepage",
"tags": [
"school project",
"vue.js",
"completed"
]
},
{
"title": "RMBG",
"description": "Easily remove background from an image with one simple click.",
"codeSrc": "https://github.com/Refansa/rmbg",
"imgSrc": "/assets/project-3.png",
"alt": "RMBG Website",
"tags": [
"personal project",
"react.js",
"completed"
]
},
{
"title": "This Portfolio",
"description": "My own portfolio!",
"codeSrc": "https://github.com/Refansa/portfolio",
"imgSrc": "/assets/project-4.png",
"alt": "Portfolio Homepage",
"tags": [
"personal project",
"react",
"in progress"
]
}
]

View File

@ -5,41 +5,16 @@ export const metadata: Metadata = {
title: 'Projects', title: 'Projects',
} }
const projectLists = [ async function getProjectLists() {
{ const res = await fetch('http://localhost:3000/api/projects')
title: 'AmanaTax',
description: 'A video course website to learn about taxes.', if (!res.ok) throw new Error('Failed to fetch project lists.')
imgSrc: '/assets/project-1.png',
alt: 'AmanaTax Homepage', return res.json()
tags: ['internship project', 'laravel', 'completed'], }
},
{ export default async function Projects() {
title: 'Koperasi', const projectLists = await getProjectLists()
description: 'Cooperatives website that accept online transactions.',
codeSrc: 'https://github.com/Refansa/koperasi',
imgSrc: '/assets/project-2.png',
alt: 'Koperasi Homepage',
tags: ['school project', 'vue.js', 'completed'],
},
{
title: 'RMBG',
description:
'Easily remove background from an image with one simple click.',
codeSrc: 'https://github.com/Refansa/rmbg',
imgSrc: '/assets/project-3.png',
alt: 'RMBG Website',
tags: ['personal project', 'react.js', 'completed'],
},
{
title: 'This Portfolio',
description: 'My own portfolio!',
codeSrc: 'https://github.com/Refansa/portfolio',
imgSrc: '/assets/project-4.png',
alt: 'Portfolio Homepage',
tags: ['personal project', 'react', 'in progress'],
},
]
export default function ProjectLists() {
return <Project projectLists={projectLists} /> return <Project projectLists={projectLists} />
} }

View File

@ -12,7 +12,7 @@ export default function SlideUpWhenVisible({
threshold?: number | number[] threshold?: number | number[]
}) { }) {
const controls = useAnimation() const controls = useAnimation()
const [ref, inView] = useInView({ threshold: threshold ? threshold : 0.35 }) const [ref, inView] = useInView({ threshold: threshold ? threshold : 0 })
useEffect(() => { useEffect(() => {
if (inView) { if (inView) {

View File

@ -11,11 +11,12 @@ import {
Text, Text,
Title, Title,
} from '@mantine/core' } from '@mantine/core'
import { IconSourceCode } from '@tabler/icons-react' import { IconBrandGithub } from '@tabler/icons-react'
import SlideUpWhenVisible from '../hooks/slideUpWhenVisible' import SlideUpWhenVisible from '../hooks/slideUpWhenVisible'
import NextImage from 'next/image'
export interface ProjectItemProps { export interface ProjectItemProps {
alt?: string alt: string
codeSrc?: any codeSrc?: any
description: string description: string
imgSrc?: any imgSrc?: any
@ -34,15 +35,19 @@ const ProjectItem = ({
return ( return (
<Card <Card
shadow='sm' shadow='sm'
padding='lg'> padding='lg'
withBorder>
<Card.Section> <Card.Section>
<AspectRatio <AspectRatio
ratio={1366 / 609} ratio={1366 / 609}
mah={160} mah={160}
my='auto'> my='auto'>
<Image <Image
component={NextImage}
src={imgSrc} src={imgSrc}
alt={alt} alt={alt}
width={340}
height={160}
/> />
</AspectRatio> </AspectRatio>
</Card.Section> </Card.Section>
@ -62,7 +67,7 @@ const ProjectItem = ({
<Badge <Badge
key={title} key={title}
radius='xs' radius='xs'
variant='outline'> variant='light'>
{tag} {tag}
</Badge> </Badge>
) )
@ -75,17 +80,18 @@ const ProjectItem = ({
mb='md'> mb='md'>
{description} {description}
</Text> </Text>
{codeSrc ? ( <Group mt='auto'>
<Button {codeSrc ? (
mt='auto' <Button
component='a' component='a'
href={codeSrc} href={codeSrc}
target='_blank' target='_blank'
leftSection={<IconSourceCode />} leftSection={<IconBrandGithub />}
variant='light'> variant='filled'>
Source Code Source Code
</Button> </Button>
) : null} ) : null}
</Group>
</Card> </Card>
) )
} }

View File

@ -0,0 +1,7 @@
.card {
@mixin dark {
&[data-with-border='true'] {
border-color: var(--mantine-color-dark-6);
}
}
}

View File

@ -0,0 +1,8 @@
import { Card as Component } from '@mantine/core'
import classes from './Card.module.css'
export const Card = Component.extend({
defaultProps: {
className: classes.card,
},
})

View File

@ -1,4 +1,5 @@
export { Button } from './Button' export { Button } from './Button'
export { Card } from './Card'
export { Drawer } from './Drawer' export { Drawer } from './Drawer'
export { Paper } from './Paper' export { Paper } from './Paper'
export { Text } from './Text' export { Text } from './Text'

View File

@ -8,6 +8,7 @@ import {
import { fluidDisplay, fluidTypography } from '../utils/typography' import { fluidDisplay, fluidTypography } from '../utils/typography'
import { import {
Button, Button,
Card,
Drawer, Drawer,
Paper, Paper,
Text, Text,
@ -148,6 +149,7 @@ export const theme = createTheme({
// Allows adding `classNames`, `styles` and `defaultProps` to any component // Allows adding `classNames`, `styles` and `defaultProps` to any component
components: { components: {
Button, Button,
Card,
Drawer, Drawer,
Paper, Paper,
Text, Text,