-
Notifications
You must be signed in to change notification settings - Fork 49
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 #199 from ourzora/proposal-template-droposal
Add proposal template droposal
- Loading branch information
Showing
22 changed files
with
1,590 additions
and
8 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,69 @@ | ||
import { Box } from '@zoralabs/zord' | ||
import NextImage from 'next/image' | ||
import { useCallback, useRef, useState } from 'react' | ||
|
||
import { Icon } from '../Icon' | ||
|
||
export interface AudioProps { | ||
src: string | ||
cover?: string | ||
} | ||
|
||
export const Audio: React.FC<AudioProps> = ({ src, cover }) => { | ||
const [playing, setPlaying] = useState(false) | ||
const audioRef = useRef<HTMLAudioElement>(null) | ||
|
||
const togglePlay = useCallback(async () => { | ||
if (!audioRef.current) return | ||
if (playing) audioRef.current.pause() | ||
else audioRef.current.play() | ||
}, [audioRef, playing]) | ||
|
||
return ( | ||
<Box position={'relative'} w="100%" h="100%"> | ||
{!cover ? ( | ||
<Box backgroundColor="background2" w="100%" h="100%" borderRadius={'curved'} /> | ||
) : ( | ||
<NextImage | ||
src={cover} | ||
width={400} | ||
height={400} | ||
unoptimized | ||
alt="Preview" | ||
style={{ | ||
objectFit: 'cover', | ||
borderRadius: '10px', | ||
height: '400px', | ||
width: '400px', | ||
}} | ||
/> | ||
)} | ||
|
||
<Box | ||
as={'button'} | ||
onClick={togglePlay} | ||
borderColor="transparent" | ||
h="x10" | ||
w="x10" | ||
cursor={'pointer'} | ||
borderRadius="round" | ||
backgroundColor={'background1'} | ||
position={'absolute'} | ||
bottom="x4" | ||
right="x4" | ||
> | ||
<Icon id={playing ? 'pause' : 'play'} fill={'text2'} /> | ||
</Box> | ||
|
||
<audio | ||
src={src} | ||
ref={audioRef} | ||
loop | ||
preload={'auto'} | ||
playsInline | ||
onPlay={() => setPlaying(true)} | ||
onPause={() => setPlaying(false)} | ||
/> | ||
</Box> | ||
) | ||
} |
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,23 @@ | ||
import NextImage from 'next/image' | ||
|
||
export interface ImageProps { | ||
src: string | ||
} | ||
|
||
export const Image: React.FC<ImageProps> = ({ src }) => { | ||
return ( | ||
<NextImage | ||
src={src} | ||
width={400} | ||
height={400} | ||
unoptimized | ||
alt="Preview" | ||
style={{ | ||
objectFit: 'cover', | ||
borderRadius: '10px', | ||
height: '400px', | ||
width: '400px', | ||
}} | ||
/> | ||
) | ||
} |
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,36 @@ | ||
import { Box } from '@zoralabs/zord' | ||
import { getFetchableUrl } from 'ipfs-service' | ||
import { useMemo } from 'react' | ||
|
||
import { Audio } from './Audio' | ||
import { Image } from './Image' | ||
import { Video } from './Video' | ||
|
||
export interface MediaPreviewProps { | ||
mediaUrl: string | ||
mediaType?: string | ||
coverUrl?: string | ||
} | ||
|
||
export const MediaPreview: React.FC<MediaPreviewProps> = ({ | ||
mediaType, | ||
mediaUrl, | ||
coverUrl, | ||
}) => { | ||
const fetchableMediaURL = useMemo(() => getFetchableUrl(mediaUrl) || '', [mediaUrl]) | ||
const fetchableCoverURL = useMemo(() => getFetchableUrl(coverUrl) || '', [coverUrl]) | ||
|
||
if (fetchableMediaURL && mediaType?.startsWith('image')) { | ||
return <Image src={fetchableMediaURL} /> | ||
} | ||
|
||
if (fetchableMediaURL && mediaType?.startsWith('video')) { | ||
return <Video src={fetchableMediaURL} /> | ||
} | ||
|
||
if (fetchableMediaURL && mediaType?.startsWith('audio')) { | ||
return <Audio src={fetchableMediaURL} cover={fetchableCoverURL} /> | ||
} | ||
|
||
return <Box backgroundColor="background2" w="100%" h="100%" borderRadius={'curved'} /> | ||
} |
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,21 @@ | ||
export interface VideoProps { | ||
src: string | ||
} | ||
|
||
export const Video: React.FC<VideoProps> = ({ src }) => { | ||
return ( | ||
<video | ||
src={src} | ||
autoPlay | ||
loop | ||
muted={true} | ||
playsInline | ||
style={{ | ||
objectFit: 'cover', | ||
borderRadius: '10px', | ||
height: '400px', | ||
width: '400px', | ||
}} | ||
/> | ||
) | ||
} |
23 changes: 23 additions & 0 deletions
23
apps/web/src/components/SingleMediaUpload/SingleMediaUpload.css.ts
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,23 @@ | ||
import { style } from '@vanilla-extract/css' | ||
|
||
export const defaultUploadStyle = style({ | ||
display: 'none', | ||
}) | ||
|
||
export const uploadErrorBox = style({ | ||
color: '#ff0015', | ||
boxSizing: 'border-box', | ||
}) | ||
|
||
export const singleMediaUploadWrapper = style({ | ||
height: 64, | ||
width: '100%', | ||
borderRadius: 15, | ||
background: '#F2F2F2', | ||
overflow: 'hidden', | ||
selectors: { | ||
'&:hover': { | ||
cursor: 'pointer', | ||
}, | ||
}, | ||
}) |
Oops, something went wrong.
0aa4af1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nouns-builder – ./apps/web
nouns-builder-ourzora.vercel.app
www.nouns.build
zouns-builder.vercel.app
nouns-builder-git-main-ourzora.vercel.app
nouns.build
0aa4af1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
testnet-nouns-builder – ./apps/web
testnet-nouns-builder-ourzora.vercel.app
testnet-nouns-builder-git-main-ourzora.vercel.app
testnet.nouns.build