-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
165 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import tw from 'twin.macro'; | ||
import React from 'react'; | ||
import { Card } from '~/components/ui/containers/Card'; | ||
import { Container } from '~/components/ui/containers/Container'; | ||
import { Grid } from '~/components/ui/containers/Grid'; | ||
import { GridColumn } from '~/components/ui/containers/GridColumn'; | ||
import { Badge } from '~/components/ui/misc/Badge'; | ||
import userProfile from '~/profile'; | ||
import { getRandomizedColor } from '~/utils/colors'; | ||
|
||
const Root = tw.div` | ||
bg-gray-300 flex-grow | ||
`; | ||
|
||
export function ProjectMain({ | ||
projects, | ||
}: { | ||
projects: typeof userProfile['projects']; | ||
}) { | ||
return ( | ||
<Root id={'content'}> | ||
<Container> | ||
<h4 tw={'type-h4 text-center p-5'}>Projects</h4> | ||
<Grid gap={5} className={'mb-5'}> | ||
{projects.map((project, index) => { | ||
return ( | ||
<GridColumn lg={4} md={6} sm={12} key={index}> | ||
<Card className={'h-64 flex flex-col'}> | ||
<h6 tw={'type-h6 text-gray-700 mb-4'}>{project.name}</h6> | ||
<p tw={'flex-grow'}>{project.description}</p> | ||
<div className={'flex flex-wrap items-center mt-3'}> | ||
{project.tags.map((tag) => ( | ||
<Badge key={tag} color={getRandomizedColor(tag)}> | ||
{' '} | ||
{tag}{' '} | ||
</Badge> | ||
))} | ||
</div> | ||
</Card> | ||
</GridColumn> | ||
); | ||
})} | ||
</Grid> | ||
</Container> | ||
</Root> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import tw, { styled } from 'twin.macro'; | ||
|
||
export const Container = styled.div` | ||
${tw`container flex flex-col md:flex-row items-center px-6`} | ||
${tw`container flex flex-col px-6`} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import 'twin.macro'; | ||
|
||
export function Badge({ color, children }) { | ||
return ( | ||
<div | ||
tw='flex text-xs justify-center items-center m-1 py-1 px-2 bg-white rounded-full border' | ||
className={`border-${color}-300 bg-${color}-100 text-${color}-700`} | ||
> | ||
<div tw='leading-none flex-initial'>{children}</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import 'twin.macro'; | ||
import { ProjectMain } from '~/components/projects/ProjectMain'; | ||
import profile from '~/profile'; | ||
|
||
const ProjectPage = () => ( | ||
<> | ||
<ProjectMain projects={profile.projects} /> | ||
</> | ||
); | ||
|
||
export default ProjectPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export function getRandomizedColor(text: string) { | ||
const randomColors = [ | ||
'blue', | ||
'red', | ||
'green', | ||
'teal', | ||
'orange', | ||
'yellow', | ||
'purple', | ||
]; | ||
let total = 0; | ||
for (const ch of text) { | ||
total += ch.charCodeAt(0); | ||
} | ||
return randomColors[total % randomColors.length]; | ||
} |