Skip to content

Commit

Permalink
Interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
loleg committed Oct 28, 2023
1 parent 26f434e commit 9afc141
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 9 deletions.
3 changes: 2 additions & 1 deletion webapp/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export default {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
'@tailwindcss/nesting': {},
},
}
Binary file removed webapp/public/art-hall-1.png
Binary file not shown.
Binary file removed webapp/public/art-hall-2.png
Binary file not shown.
57 changes: 50 additions & 7 deletions webapp/src/components/ArtObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,62 @@ import { Piece } from "../apiclient/model";
const DEFAULT_IMG = 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Optical_Toy%2C_Phenakistiscope_Disc_with_Cats_and_Donkey%2C_ca._1830.gif/640px-Optical_Toy%2C_Phenakistiscope_Disc_with_Cats_and_Donkey%2C_ca._1830.gif';

const ArtObject = ({ piece }: { piece: Piece }) => {
let imageurl = piece.screenshot ?
piece.screenshot.split(' (')[1].replace(')', '') : DEFAULT_IMG;

// Get a screenshot or image link
let imageurl =
piece["type of embed"] == 'IMAGE' ?
piece.embed
: piece.screenshot ?
piece.screenshot.split(' (')[1].replace(')', '')
: DEFAULT_IMG;

let embedurl =
piece["type of embed"] == 'IFRAME' ?
piece.embed : null;

let youtubeurl =
piece["type of embed"] == 'VIDEO'
&& piece.embed.indexOf('?v=')>1 ?
'https://www.youtube.com/embed/' + piece.embed.split('?v=')[1] : null;

// TODO: MUSIC embedder for soundcloud / spotify / ...

// Click away screenshot when embedding
let imagehide = (embedurl || youtubeurl) ? '' : 'width-full z-50';
let embedhide = imagehide ? 'hide' : '';

const [showResults, setShowResults] = React.useState(false)
const showEmbed = () => {
this.className = 'hide'
}

return (
<div className="grid h-screen place-items-center">
<h2 className="title text-6xl font-bold p-4">
{piece.name}
</h2>
<div className="image-container">
<img
className="width-full z-50"
src={imageurl}
alt="placeholder"
/>
{embedhide &&
<img
className="startmeup"
src="/playback.png"
title="Click to open interactively"
onClick={showEmbed}
/>
}
{imageurl &&
<img
className={imagehide}
src={imageurl}
alt="Image"
/>
}
{embedurl &&
<iframe src={embedurl} className={embedhide} allowFullScreen></iframe>
}
{youtubeurl &&
<iframe src={embedurl} className={embedhide} frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
}
</div>
<div className="description">
<p>{piece.context}</p>
Expand Down
11 changes: 11 additions & 0 deletions webapp/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ html, body, #root {
font-family: OldNewspaper;
}

.hide {
display: none;
}


h2.title {
Expand All @@ -49,6 +52,14 @@ h2.title {
max-width: 400px;
margin-top: -3em;
}

img.startmeup {
position: absolute;
border: none;
box-shadow: none;
margin-left: -25px;
margin-top: -25px;
}

.description {
margin: 0 20%;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/templates/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Room = ({ piece }: { piece: Piece }) => {
return (
<RoomWrapper
style={{
backgroundImage: "url(/art-hall-1.png)",
backgroundImage: "url(/art-hall-1.jpg)",
position: "relative",
}}
>
Expand Down

0 comments on commit 9afc141

Please sign in to comment.