Skip to content

Commit

Permalink
ロゴを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
piny940 committed Jul 1, 2023
1 parent db95615 commit 2a6caae
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions public/images/skills/rails.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/images/skills/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/components/Common/PieItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReactNode } from 'react'
import styled from 'styled-components'

const CircleSpan = styled.span`
const CircleDiv = styled.div`
width: 160px;
height: 160px;
background-color: white;
Expand All @@ -9,6 +10,7 @@ const CircleSpan = styled.span`
top: 20px;
left: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 30px;
Expand All @@ -33,13 +35,13 @@ const PieDiv = styled.div<{

export type PieItemProps = {
percent: number
label: string
children: ReactNode
className?: string
}

export const PieItem: React.FC<PieItemProps> = ({
percent,
label,
children,
className,
}) => {
const start = [0, 85, 255]
Expand All @@ -48,7 +50,7 @@ export const PieItem: React.FC<PieItemProps> = ({

return (
<PieDiv start={start} end={color} percent={percent} className={className}>
<CircleSpan>{label}</CircleSpan>
<CircleDiv>{children}</CircleDiv>
</PieDiv>
)
}
17 changes: 16 additions & 1 deletion src/components/Portfolio/SkillItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SkillType } from '@/resources/types'
import { PieItem } from '../Common/PieItem'
import Image from 'next/image'

export type SkillItemProps = {
skill: SkillType
Expand All @@ -9,7 +10,21 @@ export type SkillItemProps = {
export const SkillItem: React.FC<SkillItemProps> = ({ skill, className }) => {
return (
<div className={className}>
<PieItem className="mx-auto" label={skill.name} percent={skill.percent} />
<PieItem className="mx-auto" percent={skill.percent}>
<div className="d-flex flex-column mb-3">
{skill.logoSrc && (
<div className="icon text-center">
<Image
alt={`${skill.name}-logo`}
src={skill.logoSrc}
width={70}
height={70}
/>
</div>
)}
<span className="text-center">{skill.name}</span>
</div>
</PieItem>
</div>
)
}
2 changes: 2 additions & 0 deletions src/data/skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ export const skillsData: SkillType[] = [
{
name: 'Rails',
percent: 90,
logoSrc: '/images/skills/rails.svg',
},
{
name: 'React',
percent: 90,
logoSrc: '/images/skills/react.svg',
},
{
name: 'Typescript',
Expand Down
1 change: 1 addition & 0 deletions src/resources/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export type Theme = 'dark' | 'light'
export type SkillType = {
name: string
percent: number
logoSrc?: string
}

0 comments on commit 2a6caae

Please sign in to comment.