Create layout for deployments pannel (#4)

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
Nabarun Gogoi 2023-12-15 12:13:18 +05:30 committed by GitHub
parent 5a17747be2
commit 471412a8d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 133 additions and 11 deletions

View File

@ -0,0 +1,38 @@
[
{
"title": "nextjs-bolerplate-9t44zbky4dg-bygideon-projects",
"status": "Building",
"environment": "Production",
"branch": "prod",
"commit": {
"hash": "9haif19",
"message": "Update hover state"
},
"author": "Gideon",
"updatedAt": "2023-12-11T04:20:00"
},
{
"title": "nextjs-bolerplate-9232dwky4dg-bygideon-projects",
"status": "Ready",
"environment": "Preview",
"branch": "prod",
"commit": {
"hash": "43de569",
"message": "Fix lint errors"
},
"author": "Brad",
"updatedAt": "2023-12-11T04:20:00"
},
{
"title": "nextjs-bolerplate-9saa22y4dg-bygideon-projects",
"status": "Error",
"environment": "Production",
"branch": "main",
"commit": {
"hash": "4hdsf19",
"message": "Apply style to button"
},
"author": "Alice",
"updatedAt": "2023-12-11T04:20:00"
}
]

View File

@ -0,0 +1,48 @@
import React from 'react';
import { relativeTime } from '../utils/time';
interface DeploymentDetails {
title: string;
status: string;
environment: string;
branch: string;
commit: {
hash: string;
message: string;
};
author: string;
updatedAt: string;
}
interface DeployDetailsCardProps {
deployment: DeploymentDetails;
}
const DeployDetailsCard = ({ deployment }: DeployDetailsCardProps) => {
return (
<div className="grid grid-cols-4 gap-2 text-sm text-gray-600 border-b border-gray-300">
<div className="col-span-2">
<div className="flex">
<p className=" text-gray-900 basis-2/3">{deployment.title}</p>
<p className="basis-1/3">{deployment.status}</p>
</div>
<p>{deployment.environment}</p>
</div>
<div className="col-span-1">
<p>{deployment.branch}</p>
<p>
{deployment.commit.hash} {deployment.commit.message}
</p>
</div>
<div className="col-span-1 flex items-center">
<p className="grow">
{relativeTime(deployment.updatedAt)} ^ {deployment.author}
</p>
<button className="self-start">...</button>
</div>
</div>
);
};
export default DeployDetailsCard;

View File

@ -0,0 +1,41 @@
import React from 'react';
import deploymentDetails from '../assets/deployments.json';
import DeployDetailsCard from './DeploymentDetailsCard';
const Deployments = () => {
return (
<div className="p-4">
<div className="grid grid-cols-4 gap-2 text-sm text-gray-600">
<div className="col-span-2">
<input
type="text"
className="border border-gray-300 rounded p-2 w-full focus:border-blue-300 focus:outline-none focus:shadow-outline-blue"
placeholder="Search branches"
/>
</div>
<div className="col-span-1">
<input
type="text"
className="border border-gray-300 rounded p-2 w-full focus:border-blue-300 focus:outline-none focus:shadow-outline-blue"
placeholder="All time"
/>
</div>
<div className="col-span-1">
<input
type="text"
className="border border-gray-300 rounded p-2 w-full focus:border-blue-300 focus:outline-none focus:shadow-outline-blue"
placeholder="All status"
/>
</div>
</div>
<div className="mt-2">
{deploymentDetails.map((deployment, key) => {
return <DeployDetailsCard deployment={deployment} key={key} />;
})}
</div>
</div>
);
};
export default Deployments;

View File

@ -21,7 +21,7 @@ const Overview = ({ project }: OverviewProps) => (
</div> </div>
<div className="flex justify-between p-2 text-sm"> <div className="flex justify-between p-2 text-sm">
<p>Domain</p> <p>Domain</p>
<button>Set up</button> {project.domain ? <p>{project.domain}</p> : <button>Set up</button>}
</div> </div>
<div className="flex justify-between p-2 text-sm"> <div className="flex justify-between p-2 text-sm">
<p>Source</p> <p>Source</p>

View File

@ -1,12 +1,14 @@
import React from 'react'; import React from 'react';
import { NavLink } from 'react-router-dom'; import { Link, NavLink } from 'react-router-dom';
const Sidebar = () => { const Sidebar = () => {
return ( return (
<div className="flex flex-col h-full p-4"> <div className="flex flex-col h-full p-4">
<div className="grow"> <div className="grow">
<div> <div>
<Link to="/">
<h3 className="text-black text-2xl">Snowball</h3> <h3 className="text-black text-2xl">Snowball</h3>
</Link>
</div> </div>
<div>Organization</div> <div>Organization</div>
<div> <div>

View File

@ -2,20 +2,13 @@ import React from 'react';
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
import Overview from './Overview'; import Overview from './Overview';
import Deployments from './Deployments';
import { ProjectDetails } from '../types/project'; import { ProjectDetails } from '../types/project';
interface ProjectTabsProps { interface ProjectTabsProps {
project: ProjectDetails; project: ProjectDetails;
} }
const Deployments = () => (
<div>
Content of deployments tab
<p className="block">
Contrary to popular belief, Lorem Ipsum is not simply random text.
</p>
</div>
);
const Database = () => ( const Database = () => (
<div> <div>
Content of database tab Content of database tab