Skip to content

Commit

Permalink
update list page
Browse files Browse the repository at this point in the history
  • Loading branch information
Zajaczkowskim committed Sep 28, 2024
1 parent 5848216 commit 866ad37
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
14 changes: 9 additions & 5 deletions parent_app/src/app/list/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// app/page.tsx (or any page you'd like to use)
'use client'
import { useEffect, useState } from 'react';
import Card from '../../components/Card';

type ImageData = {
_id: string;
Expand Down Expand Up @@ -29,22 +30,25 @@ const ImageGallery = () => {
}, []);

if (loading) {
return <p>Loading images...</p>;
return <p className="text-black">Loading images...</p>;
}

return (
<div>
<h1>Image Gallery</h1>
<div className='min-h-screen bg-gray-100 p-4'>
<h1 className="text-black">Image Gallery</h1>
<ul style={{ listStyleType: 'none', padding: 0 }}>
{images.map((image) => (
{/* {images.map((image) => (
<li key={image._id} style={{ marginBottom: '20px' }}>
<img
src={`data:image/png;base64,${image.buffer}`}
alt="Submitted"
style={{ width: '200px', height: '200px', objectFit: 'cover' }}
/>
<p>Submitted at: {new Date(image.submittedAt).toLocaleString()}</p>
</li>
</li>
))} */}
{images.map((image) => (
<Card image={image} waga={238} godzina={'16:40'} />
))}
</ul>
</div>
Expand Down
40 changes: 40 additions & 0 deletions parent_app/src/components/Card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import smile from '../icons/smile.svg';
import sad from '../icons/sad.svg';

const Card = ({ image, waga, godzina }) => {
return ( <>

<div className="bg-white rounded-lg p-4 mb-4 shadow-md items-center" style={{ width: '350px', height: '150px' }}>
<div>
<p className="text-black">10.05.2024</p>
</div>
<div className="w-full h-full flex">
{/* Left side: Image */}
<div className="w-1/3 h-full">
{/* <img
src={`data:image/png;base64,${image.buffer}`}
alt="Card Image"
className="w-full max-h-full object-cover rounded-md"
style={{ objectFit: 'cover' }}
/> */}
<svg
src="../icons/smile.svg"
alt="Card Image"
className="w-full max-h-full object-cover rounded-md"
style={{ objectFit: 'cover' }}
/>
</div>

{/* Right side: Text fields */}
<div className="w-2/3 h-full pl-4 flex flex-col justify-center">
<p className="text-black">Waga: {waga} g</p>
<p className="text-black">Godzina: {godzina}</p>
</div>
</div>
</div>
</>
);
};

export default Card;

3 changes: 3 additions & 0 deletions parent_app/src/icons/sad.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions parent_app/src/icons/smile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 866ad37

Please # to comment.