Add dummy data for project cards in home page (#1)

* Add switching of repository list and connect account

* Populate project cards with dummy projects data

* Fix typos of dummy datas

* Fix prettier error

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
Nabarun Gogoi 2023-12-13 17:42:39 +05:30 committed by GitHub
parent 87ca0e3403
commit bb723ee58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 130 additions and 33 deletions

View File

@ -0,0 +1,42 @@
[
{
"icon": "^",
"title": "iglotools",
"domain": "iglotools.com",
"latestCommit": {
"message": "Subscription added",
"time": "2023-12-11T04:20:00",
"branch": "main"
}
},
{
"icon": "^",
"title": "iglotools",
"domain": "iglotools.com",
"latestCommit": {
"message": "404 added",
"time": "2023-12-11T04:20:00",
"branch": "staging"
}
},
{
"icon": "^",
"title": "iglotools",
"domain": "iglotools.com",
"latestCommit": {
"message": "Design system integrated",
"time": "2023-12-11T04:20:00",
"branch": "main"
}
},
{
"icon": "^",
"title": "watcher-tool",
"domain": "azimuth-watcher.com",
"latestCommit": {
"message": "Listen for subscription",
"time": "2023-12-10T04:20:00",
"branch": "prod"
}
}
]

View File

@ -1,22 +0,0 @@
import React from 'react';
const Card = () => {
return (
<div className="bg-white border border-gray-200 rounded-lg shadow">
<div className="flex gap-2 p-2 items-center">
<div>^</div>
<div className="grow">
<p className="text-sm text-gray-750">iglotools</p>
<p className="text-sm text-gray-400">iglotools.com</p>
</div>
<div>...</div>
</div>
<div className="border-slate-200 border-t-2 border-solid p-4 text-gray-500 text-xs">
<p>Hello world</p>
<p>3 day ago main</p>
</div>
</div>
);
};
export default Card;

View File

@ -0,0 +1,26 @@
import React from 'react';
const ConnectAccount = () => {
return (
<div className="bg-gray-100 flex flex-col p-4 justify-end items-center text-center text-sm h-60 rounded-2xl">
<div>^</div>
<div>
<p>Connect to your git account</p>
<p>
Once connected, you can create projects by importing repositories
under the account
</p>
</div>
<div>
<button className="bg-gray-300 rounded-full mx-2">
Connect to Github
</button>
<button className="bg-gray-300 rounded-full mx-2">
Connect to Gitea
</button>
</div>
</div>
);
};
export default ConnectAccount;

View File

@ -0,0 +1,7 @@
import React from 'react';
const HorizontalLine = () => {
return <hr className="h-px bg-slate-200 border-0" />;
};
export default HorizontalLine;

View File

@ -0,0 +1,39 @@
import React from 'react';
import { DateTime } from 'luxon';
interface projectDetails {
icon: string;
title: string;
domain: string;
latestCommit: {
[key: string]: string;
};
}
interface ProjectCardProps {
project: projectDetails;
}
const ProjectCard: React.FC<ProjectCardProps> = ({ project }) => {
return (
<div className="bg-white border border-gray-200 rounded-lg shadow">
<div className="flex gap-2 p-2 items-center">
<div>{project.icon}</div>
<div className="grow">
<p className="text-sm text-gray-750">{project.title}</p>
<p className="text-sm text-gray-400">{project.domain}</p>
</div>
<div>...</div>
</div>
<div className="border-slate-200 border-t-2 border-solid p-4 text-gray-500 text-xs">
<p>{project.latestCommit.message}</p>
<p>
{DateTime.fromISO(project.latestCommit.time).toRelative()} on{' '}
{project.latestCommit.branch}
</p>
</div>
</div>
);
};
export default ProjectCard;

View File

@ -5,6 +5,7 @@ interface RepositoryDetails {
title: string;
updatedTime: string;
}
interface ProjectRepoCardProps {
repository: RepositoryDetails;
}

View File

@ -2,7 +2,7 @@ import React from 'react';
import SearchBar from './SearchBar';
import ProjectRepoCard from './ProjectRepoCard';
import repositoryDetails from '../assets/repository.json';
import repositoryDetails from '../assets/repositories.json';
const RepositoryList = () => {
return (

View File

@ -2,7 +2,9 @@ import React from 'react';
import { Link } from 'react-router-dom';
import SearchBar from '../components/SearchBar';
import Card from '../components/Card';
import ProjectCard from '../components/ProjectCard';
import HorizontalLine from '../components/HorizontalLine';
import projectsDetail from '../assets/projects.json';
const Projects = () => {
return (
@ -15,7 +17,7 @@ const Projects = () => {
<div className="text-gray-300">^</div>
<div className="text-gray-300">^</div>
</div>
<hr className="h-px bg-slate-200 border-0" />
<HorizontalLine />
<div className="flex p-4">
<div className="grow">
<h3 className="text-gray-750 text-2xl">Projects</h3>
@ -30,10 +32,9 @@ const Projects = () => {
</div>
</div>
<div className="grid grid-cols-3 gap-5 p-5">
<Card />
<Card />
<Card />
<Card />
{projectsDetail.map((project, key) => {
return <ProjectCard project={project} key={key} />;
})}
</div>
</div>
);

View File

@ -1,13 +1,16 @@
import React from 'react';
import { Link } from 'react-router-dom';
import templateDetails from '../../assets/template.json';
import templateDetails from '../../assets/templates.json';
import TemplateCard from '../../components/TemplateCard';
import RepositoryList from '../../components/RepositoryList';
import ConnectAccount from '../../components/ConnectAccount';
const isGitAuth = false;
const CreateProject = () => {
return (
<div className="bg-white rounded-3xl h-full">
<div className="bg-white rounded-3xl h-full p-4">
<div className="flex p-2">
<div className="grow p-4">
<h3 className="text-gray-750 text-2xl">Create new project</h3>
@ -28,7 +31,7 @@ const CreateProject = () => {
})}
</div>
<h5 className="mt-4 ml-4">Import a repository</h5>
<RepositoryList />
{isGitAuth ? <RepositoryList /> : <ConnectAccount />}
</div>
);
};

View File

@ -1,6 +1,6 @@
import React from 'react';
import CreateProject from './CreateProject';
import CreateProject from './Create';
import Project from './Project';
export const projectsRoutes = [