-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from LinumLabs/feature/mm/loading-image-grid-start
Feature/mm/loading image grid start
- Loading branch information
Showing
23 changed files
with
316 additions
and
32 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,34 @@ | ||
import { PodDir } from 'contexts/Dirs'; | ||
import Link from 'next/link'; | ||
|
||
interface Props { | ||
pod: string; | ||
dirs: PodDir[]; | ||
} | ||
|
||
const DirsGrid = ({ pod, dirs }: Props) => { | ||
return ( | ||
<div className="flex flex-wrap my-6"> | ||
{dirs && | ||
dirs.map((dir, key: number) => ( | ||
<div key={key} className="text-purple"> | ||
<Link href={`/pods/${pod}/${dir.name}`}> | ||
<a className="inline-block w-72 h-72 mr-12 rounded-lg bg-gray"></a> | ||
</Link> | ||
<footer className="px-2 py-3"> | ||
<div> | ||
<strong>{dir.name}</strong> | ||
</div> | ||
<div> | ||
{new Intl.DateTimeFormat('en-GB', { | ||
dateStyle: 'long', | ||
}).format(Number(dir.creation_time) * 1000)} | ||
</div> | ||
</footer> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DirsGrid; |
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,4 @@ | ||
.imageGridItem { | ||
height: 180px; | ||
padding: 6px; | ||
} |
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,27 @@ | ||
import classes from './ImageGrid.module.scss'; | ||
|
||
interface Props { | ||
images: string[]; | ||
className?: string; | ||
} | ||
|
||
const ImageGrid = ({ images }: Props) => { | ||
return ( | ||
<div className={classes.content}> | ||
<div className="flex flex-wrap"> | ||
{images && !!images.length | ||
? images.map((file, key: number) => ( | ||
<img | ||
className={classes.imageGridItem} | ||
src={file} | ||
key={String(key) + file} | ||
alt={String(key)} | ||
/> | ||
)) | ||
: 'No photos'} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ImageGrid; |
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
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,11 @@ | ||
import GearIcon from 'assets/gear-icon-72a7cf.svg'; | ||
|
||
const Spinner = () => { | ||
return ( | ||
<div className="inline-block animate-spin-slow"> | ||
<GearIcon /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Spinner; |
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,20 @@ | ||
import { createContext, Dispatch, SetStateAction } from 'react'; | ||
|
||
export type PodDir = { | ||
access_time: string; | ||
content_type: string; | ||
creation_time: string; | ||
modification_time: string; | ||
name: string; | ||
}; | ||
|
||
export interface DirsContextProps { | ||
dirs: PodDir[]; | ||
setDirs: Dispatch<SetStateAction<PodDir[]>>; | ||
} | ||
|
||
export const DirsContext = createContext<DirsContextProps>( | ||
{} as DirsContextProps | ||
); | ||
|
||
export default DirsContext.Provider; |
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,22 @@ | ||
import { createContext, Dispatch, SetStateAction } from 'react'; | ||
|
||
export type PodFile = { | ||
access_time: string; | ||
block_size: string; | ||
content_type: string; | ||
creation_time: string; | ||
modification_time: string; | ||
name: string; | ||
size: string; | ||
}; | ||
|
||
export interface FilesContextProps { | ||
files: string[]; | ||
setFiles: Dispatch<SetStateAction<string[]>>; | ||
} | ||
|
||
export const FilesContext = createContext<FilesContextProps>( | ||
{} as FilesContextProps | ||
); | ||
|
||
export default FilesContext.Provider; |
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,3 @@ | ||
export default function urlPath(path: string): string { | ||
return path.replace(/&/g, '/'); | ||
} |
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,6 @@ | ||
import { DirsContext } from 'contexts/Dirs'; | ||
import { useContext } from 'react'; | ||
|
||
const useDirs = () => useContext(DirsContext); | ||
|
||
export default useDirs; |
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,6 @@ | ||
import { FilesContext } from 'contexts/Files'; | ||
import { useContext } from 'react'; | ||
|
||
const useFiles = () => useContext(FilesContext); | ||
|
||
export default useFiles; |
Oops, something went wrong.