-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
394 additions
and
18,450 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,27 @@ | ||
export default function Image({ baseUrl, alt, width, height }) { | ||
export default function Image({ data, width, height }) { | ||
return ( | ||
<img | ||
src={baseUrl.replace( | ||
"media.graphassets.com", | ||
`media.graphassets.com/resize=fit:crop,width:${width},height:${height}` | ||
)} | ||
alt={alt} | ||
width={width} | ||
height={height} | ||
src={ | ||
width && height | ||
? data.file.url.replace( | ||
"media.graphassets.com", | ||
`media.graphassets.com/resize=fit:crop,width:${width},height:${height}` | ||
) | ||
: width | ||
? data.file.url.replace( | ||
"media.graphassets.com", | ||
`media.graphassets.com/resize=width:${width}` | ||
) | ||
: height | ||
? data.file.url.replace( | ||
"media.graphassets.com", | ||
`media.graphassets.com/resize=height:${height}` | ||
) | ||
: data.file.url | ||
} | ||
alt={data.alt} | ||
{...(width && { width })} | ||
{...(height && { height })} | ||
/> | ||
); | ||
} |
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 Image from "./image"; | ||
|
||
export default function MixedContent({ data }) { | ||
return data.map(function (block) { | ||
switch (block.__typename) { | ||
case "TextBlock": | ||
return ( | ||
<div | ||
className="text-block" | ||
dangerouslySetInnerHTML={{ __html: block.richtext.html }} | ||
key={block.id} | ||
/> | ||
); | ||
case "VisualBlock": | ||
return ( | ||
<div className="visual-block" key={block.id}> | ||
{block.columns.map((col) => ( | ||
<figure key={col.id}> | ||
<Image data={col} height={300} /> | ||
<figcaption>{col.alt}</figcaption> | ||
</figure> | ||
))} | ||
</div> | ||
); | ||
} | ||
}); | ||
} |
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 |
---|---|---|
@@ -1,3 +1,61 @@ | ||
export default function About(){ | ||
return <h1>This is About.</h1> | ||
} | ||
import { useLoaderData } from "@remix-run/react"; | ||
import { request, gql } from "graphql-request"; | ||
import styles from "../../styles/artworks.css"; | ||
|
||
export const links = () => [ | ||
{ | ||
rel: "stylesheet", | ||
href: styles, | ||
}, | ||
]; | ||
|
||
export const meta = ({ data: { page } }) => page.meta; | ||
|
||
export async function loader() { | ||
const query = gql` | ||
{ | ||
page(where: { slug: "about" }) { | ||
meta { | ||
description | ||
title | ||
} | ||
conntent { | ||
blocks | ||
} | ||
content { | ||
blocks { | ||
... on TextBlock { | ||
__typename | ||
id | ||
richtext { | ||
html | ||
} | ||
} | ||
... on VisualBlock { | ||
__typename | ||
columns { | ||
alt | ||
file { | ||
url | ||
} | ||
id | ||
} | ||
id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
return request(process.env.CONTENT_API, query); | ||
} | ||
|
||
export default function Artworks() { | ||
const { page } = useLoaderData(); | ||
console.log(page) | ||
return ( | ||
<main className="artworks"> | ||
{/* <MixedContent data={page.MixedContent}/> */} | ||
</main> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
import { redirect } from "@remix-run/node"; | ||
import { Link, Outlet, useLoaderData } from "@remix-run/react"; | ||
import { request, gql } from "graphql-request"; | ||
|
||
import styles from "../styles/slides.css"; | ||
|
||
export const links = () => [ | ||
{ | ||
rel: "stylesheet", | ||
href: styles, | ||
}, | ||
]; | ||
|
||
export const meta = ({ data: { artwork } }) => artwork.meta; | ||
|
||
export const shouldRevalidate = () => true; | ||
|
||
export async function loader({ params: { index } }) { | ||
const query = gql` | ||
query { | ||
artwork(where: { slug: "adilette-carinthia-ry-hypo" }) { | ||
image { | ||
alt | ||
} | ||
meta { | ||
description | ||
title | ||
} | ||
slides { | ||
__typename | ||
} | ||
} | ||
} | ||
`; | ||
const { artwork } = await request(process.env.CONTENT_API, query); | ||
const i = parseInt(index); | ||
const n = artwork.slides.length; | ||
if (i < 1 || i > n) { | ||
redirect("/404"); | ||
} | ||
return { artwork, i, n }; | ||
} | ||
|
||
export default function Slides() { | ||
const { artwork, i, n } = useLoaderData(); | ||
return ( | ||
<> | ||
<Outlet /> | ||
<div className="caption">{artwork.image.alt}</div> | ||
<nav className="slideNav"> | ||
{i > 1 && ( | ||
<Link className="prev" to={`../${i - 1}`} relative="path"> | ||
<svg> | ||
<use href="/icons.svg#leftArrow" /> | ||
</svg> | ||
</Link> | ||
)} | ||
<div className="indicator">{`${i}/${n}`}</div> | ||
{i < n && ( | ||
<Link className="next" to={`../${i + 1}`} relative="path"> | ||
<svg> | ||
<use href="/icons.svg#rightArrow" /> | ||
</svg> | ||
</Link> | ||
)} | ||
</nav> | ||
<Link className="close" to="/artworks"> | ||
<svg> | ||
<use href="/icons.svg#close" /> | ||
</svg> | ||
</Link> | ||
</> | ||
); | ||
} |
Oops, something went wrong.