Add basic styling to parts page
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import { useMutation, useFlash } from '@redwoodjs/web'
|
import { useMutation, useFlash } from '@redwoodjs/web'
|
||||||
import { Link, routes } from '@redwoodjs/router'
|
import { Link, routes } from '@redwoodjs/router'
|
||||||
|
|
||||||
|
import avatar from 'src/assets/harold.jpg'
|
||||||
|
|
||||||
const DELETE_PART_MUTATION = gql`
|
const DELETE_PART_MUTATION = gql`
|
||||||
mutation DeletePartMutation($id: Int!) {
|
mutation DeletePartMutation($id: Int!) {
|
||||||
deletePart(id: $id) {
|
deletePart(id: $id) {
|
||||||
@@ -50,58 +52,27 @@ const PartsList = ({ parts }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rw-segment rw-table-wrapper-responsive">
|
<div className="max-w-6xl mx-auto grid gap-8 grid-cols-4">
|
||||||
<table className="rw-table">
|
{parts.map((part) => {
|
||||||
<thead>
|
return (
|
||||||
<tr>
|
<Link
|
||||||
<th>Id</th>
|
to={routes.part({ id: part.id })}
|
||||||
<th>Title</th>
|
title={'Show part ' + part.id + ' detail'}
|
||||||
<th>Description</th>
|
key={part.id}
|
||||||
<th>Code</th>
|
className="relative bg-gray-900 rounded-t-2xl"
|
||||||
<th>Main image</th>
|
>
|
||||||
<th>Created at</th>
|
<div className="rounded-t-2xl bg-gray-900">
|
||||||
<th> </th>
|
<div className="flex items-center p-2 text-indigo-200">
|
||||||
</tr>
|
<div className="h-full absolute inset-0 text-6xl flex items-center justify-center text-indigo-700" ><span>?</span></div>
|
||||||
</thead>
|
<div className="mr-4"><img src={avatar} className="rounded-full h-10 w-10" /></div>
|
||||||
<tbody>
|
<h3>{part.title}</h3>
|
||||||
{parts.map((part) => (
|
</div>
|
||||||
<tr key={part.id}>
|
<div className="relative z-10">
|
||||||
<td>{truncate(part.id)}</td>
|
<img className="h-full" src={part.mainImage}/>
|
||||||
<td>{truncate(part.title)}</td>
|
</div>
|
||||||
<td>{truncate(part.description)}</td>
|
</div>
|
||||||
<td>{truncate(part.code)}</td>
|
</Link>
|
||||||
<td>{truncate(part.mainImage)}</td>
|
)})}
|
||||||
<td>{timeTag(part.createdAt)}</td>
|
|
||||||
<td>
|
|
||||||
<nav className="rw-table-actions">
|
|
||||||
<Link
|
|
||||||
to={routes.part({ id: part.id })}
|
|
||||||
title={'Show part ' + part.id + ' detail'}
|
|
||||||
className="rw-button rw-button-small"
|
|
||||||
>
|
|
||||||
Show
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
to={routes.editPart({ id: part.id })}
|
|
||||||
title={'Edit part ' + part.id}
|
|
||||||
className="rw-button rw-button-small rw-button-blue"
|
|
||||||
>
|
|
||||||
Edit
|
|
||||||
</Link>
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
title={'Delete part ' + part.id}
|
|
||||||
className="rw-button rw-button-small rw-button-red"
|
|
||||||
onClick={() => onDeleteClick(part.id)}
|
|
||||||
>
|
|
||||||
Delete
|
|
||||||
</a>
|
|
||||||
</nav>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
* END --- TAILWIND GENERATOR EDIT
|
* END --- TAILWIND GENERATOR EDIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
/* TODO can I use a tailwind class here? */
|
||||||
|
background-color: #4a5568;
|
||||||
|
}
|
||||||
|
|
||||||
button, input, label, textarea {
|
button, input, label, textarea {
|
||||||
display: block;
|
display: block;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { Link, routes } from '@redwoodjs/router'
|
import { Link, routes } from '@redwoodjs/router'
|
||||||
import { useAuth } from '@redwoodjs/auth'
|
import { useAuth } from '@redwoodjs/auth'
|
||||||
|
import { Flash } from '@redwoodjs/web'
|
||||||
|
import Tooltip from '@material-ui/core/Tooltip';
|
||||||
|
|
||||||
import avatar from 'src/assets/harold.jpg'
|
import avatar from 'src/assets/harold.jpg'
|
||||||
import Svg from 'src/components/Svg'
|
import Svg from 'src/components/Svg'
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
|
||||||
|
|
||||||
const MainLayout = ({ children }) => {
|
const MainLayout = ({ children }) => {
|
||||||
const { logIn, logOut, isAuthenticated } = useAuth()
|
const { logIn, logOut, isAuthenticated } = useAuth()
|
||||||
@@ -28,11 +30,16 @@ const MainLayout = ({ children }) => {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul className="flex items-center">
|
<ul className="flex items-center">
|
||||||
<li className="mr-8 rounded-full border-2 border-indigo-300"><Svg name="plus" className="text-indigo-300" /></li>
|
<li className="mr-8 rounded-full border-2 border-indigo-300">
|
||||||
|
<Link to={routes.newPart()}>
|
||||||
|
<Svg name="plus" className="text-indigo-300" />
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
<li className="mr-12 p-px border-2 rounded-full border-indigo-300"><img src={avatar} className="rounded-full h-10 w-10" /></li>
|
<li className="mr-12 p-px border-2 rounded-full border-indigo-300"><img src={avatar} className="rounded-full h-10 w-10" /></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
<Flash timeout={1000} />
|
||||||
<main>{children}</main>
|
<main>{children}</main>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
import { Link, routes } from '@redwoodjs/router'
|
|
||||||
import { Flash } from '@redwoodjs/web'
|
|
||||||
|
|
||||||
const PartsLayout = (props) => {
|
const PartsLayout = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className="rw-scaffold">
|
<div className="mt-8">
|
||||||
<Flash timeout={1000} />
|
<main>{props.children}</main>
|
||||||
<header className="rw-header">
|
|
||||||
<h1 className="rw-heading rw-heading-primary">
|
|
||||||
<Link to={routes.parts()} className="rw-link">
|
|
||||||
Parts
|
|
||||||
</Link>
|
|
||||||
</h1>
|
|
||||||
<Link to={routes.newPart()} className="rw-button rw-button-green">
|
|
||||||
<div className="rw-button-icon">+</div> New Part
|
|
||||||
</Link>
|
|
||||||
</header>
|
|
||||||
<main className="rw-main">{props.children}</main>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const PostsLayout = (props) => {
|
|||||||
<div className="rw-button-icon">+</div> New Post
|
<div className="rw-button-icon">+</div> New Post
|
||||||
</Link>
|
</Link>
|
||||||
</header>
|
</header>
|
||||||
<main className="rw-main">{props.children}</main>
|
<main>{props.children}</main>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user