Skip to content

Commit

Permalink
Temp Blur route #55
Browse files Browse the repository at this point in the history
  • Loading branch information
kevenleone committed Oct 1, 2023
1 parent 66897f8 commit e0e2776
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions apps/mdreader/app/routes/blur.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useState } from 'react';
import BlurhashFallback from '~/components/blurhash-fallback';
import { encodeImageToBlurhash } from '~/utils/blurhash';

const Blur = () => {
const [options, setOptions] = useState({
blurhash: 'L59@6L-U01D*r_WVR*R*00E3~V%M',
src: 'https://images.unsplash.com/photo-1686648420191-3a4d35073fd6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1287&q=80',
});

async function encodeHash() {
const image = prompt('What image....');

const { blurhash, error } = await encodeImageToBlurhash(`${image}`);

if (error) {
return console.log('error', error);
}

console.log(blurhash);

setOptions({
blurhash: blurhash as string,
src: image as string,
});
}

return (
<div className="max-w-xs">
<button onClick={encodeHash}>Encode</button>

<BlurhashFallback
blurhash={options.blurhash}
blurHashProps={{ height: 479, width: 320 }}
description="asdad"
src={options.src}
/>
</div>
);
};
export default Blur;

1 comment on commit e0e2776

@vercel
Copy link

@vercel vercel bot commented on e0e2776 Oct 1, 2023

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:

mdreader – ./

mdreader-kevenleone.vercel.app
mdreader.vercel.app
mdreader-git-main-kevenleone.vercel.app

Please sign in to comment.