Skip to content

Commit

Permalink
Merge pull request #13 from hrdtbs/fix/mp3
Browse files Browse the repository at this point in the history
  • Loading branch information
hrdtbs authored Mar 5, 2020
2 parents 03fd3a5 + aff71b7 commit 1e0b48e
Show file tree
Hide file tree
Showing 88 changed files with 7 additions and 52 deletions.
32 changes: 5 additions & 27 deletions components/Voice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import clsx from "clsx"

const Voice: React.FC<{ name: string }> = ({ name }) => {
const audioRef = useRef<HTMLAudioElement>(null)
const [duration, setDuration] = useState(0)
const [active, setActive] = useState(false)
const handleClick = useCallback(async () => {
const el = audioRef.current

if (el) {
setDuration(el.duration)
await el.play()
}
}, [audioRef])
Expand All @@ -18,6 +15,7 @@ const Voice: React.FC<{ name: string }> = ({ name }) => {
<figure onClick={handleClick} className={clsx({ active })}>
<style jsx>{`
figure {
user-select: none;
position: relative;
display: inline-flex;
flex: 1 1 auto;
Expand All @@ -29,41 +27,21 @@ const Voice: React.FC<{ name: string }> = ({ name }) => {
cursor: pointer;
background-color: #faa65f;
border-left: 12px solid #fcdfa1;
transition: 0.3s ease-in-out;
border-radius: 10px;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
figure::before {
content: "";
display: block;
position: absolute;
top: 0px;
left: 0px;
height: 100%;
background-color: black;
mix-blend-mode: soft-light;
will-change: width;
transform: translate3d(0, 0, 0);
}
`}</style>
<style jsx>{`
figure.active::before {
animation: decrement ${duration}s ease-in-out;
}
@keyframes decrement {
0% {
width: 100%;
}
100% {
width: 0%;
}
figure.active {
background-color: #f06808;
}
`}</style>
<figcaption>{name}</figcaption>
<audio
preload="metadata"
src={`/static/voices/${name}.mp3`}
ref={audioRef}
src={`/static/voices/${name}.mp4`}
onPlay={() => setActive(true)}
onEnded={() => setActive(false)}
></audio>
Expand Down
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const nextConfig = {
}
},
{
urlPattern: /.(?:png|webp|svg|mp4)$/,
urlPattern: /.(?:png|webp|svg)$/,
handler: "CacheFirst"
}
]
Expand Down
24 changes: 1 addition & 23 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,7 @@ class MyDocument extends Document {
render() {
return (
<Html lang="ja">
<Head>
{/*
<link rel="preconnect" href="https://fonts.gstatic.com/" crossOrigin />
<link
href="https://fonts.googleapis.com/css?family=Kosugi+Maru&display=swap&subset=japanese"
rel="stylesheet"
/>
<link rel="preconnect" href="https://www.google-analytics.com" crossOrigin="true" />
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-90236823-7" />
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-90236823-7');
`
}}
></script>
*/}
</Head>
<Head />
<body>
<Main />
<NextScript />
Expand Down
1 change: 0 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCallback, useState } from "react"
import { version } from "../package.json"
import { voices } from "../constants/voices"
import InstallPWA from "../components/InstallPWA"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/static/voices/あなたは私のもの.mp4
Binary file not shown.
Binary file added public/static/voices/あーん.mp3
Binary file not shown.
Binary file removed public/static/voices/あーん.mp4
Binary file not shown.
Binary file added public/static/voices/う、うめぇ.mp3
Binary file not shown.
Binary file removed public/static/voices/う、うめぇ.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/おにいちゃん.mp3
Binary file not shown.
Binary file removed public/static/voices/おにいちゃん.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/がんばれがんばれ.mp3
Binary file not shown.
Binary file removed public/static/voices/がんばれがんばれ.mp4
Binary file not shown.
Binary file not shown.
Binary file removed public/static/voices/がんばれがんばれ2.mp4
Binary file not shown.
Binary file added public/static/voices/ぎゅーってして?.mp3
Binary file not shown.
Binary file removed public/static/voices/ぎゅーってして?.mp4
Binary file not shown.
Binary file added public/static/voices/ごめんなさーい.mp3
Binary file not shown.
Binary file removed public/static/voices/ごめんなさーい.mp4
Binary file not shown.
Binary file added public/static/voices/ごめんね?.mp3
Binary file not shown.
Binary file removed public/static/voices/ごめんね?.mp4
Binary file not shown.
Binary file not shown.
Binary file removed public/static/voices/しばしまたれいっ!.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/だいすきです.mp3
Binary file not shown.
Binary file removed public/static/voices/だいすきです.mp4
Binary file not shown.
Binary file added public/static/voices/だめだめだめだめ.mp3
Binary file not shown.
Binary file removed public/static/voices/だめだめだめだめ.mp4
Binary file not shown.
Binary file not shown.
Binary file removed public/static/voices/とぅんとぅんとぅん.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/やっちゃった〜.mp3
Binary file not shown.
Binary file removed public/static/voices/やっちゃった〜.mp4
Binary file not shown.
Binary file added public/static/voices/やっていこう!.mp3
Binary file not shown.
Binary file removed public/static/voices/やっていこう!.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/下心あれば水心.mp3
Binary file not shown.
Binary file removed public/static/voices/下心あれば水心.mp4
Binary file not shown.
Binary file added public/static/voices/世界一かわいい.mp3
Binary file not shown.
Binary file removed public/static/voices/世界一かわいい.mp4
Binary file not shown.
Binary file added public/static/voices/二窓してるの?.mp3
Binary file not shown.
Binary file removed public/static/voices/二窓してるの?.mp4
Binary file not shown.
Binary file added public/static/voices/今日もお疲れ様.mp3
Binary file not shown.
Binary file removed public/static/voices/今日もお疲れ様.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/何?通分って??.mp3
Binary file not shown.
Binary file removed public/static/voices/何?通分って??.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/static/voices/幸せになれますよー.mp4
Binary file not shown.
Binary file added public/static/voices/来ちゃった♡.mp3
Binary file not shown.
Binary file removed public/static/voices/来ちゃった♡.mp4
Binary file not shown.
Binary file added public/static/voices/死は救済です。.mp3
Binary file not shown.
Binary file removed public/static/voices/死は救済です。.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/voices/笑い声.mp3
Binary file not shown.
Binary file removed public/static/voices/笑い声.mp4
Binary file not shown.
Binary file added public/static/voices/結婚するのか?.mp3
Binary file not shown.
Binary file removed public/static/voices/結婚するのか?.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.

1 comment on commit 1e0b48e

@vercel
Copy link

@vercel vercel bot commented on 1e0b48e Mar 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.