linkInBioTemplatemain.tsx4 matches
3* Users can vote for their preferred seminar location from four options.
4* The app uses React for the frontend and SQLite for storing votes on the backend.
5* The design is inspired by Side.school and includes an image in the first frame.
6* It features a celebration animation when voting, a distinct style for the selected option,
7* and allows users to cancel their vote by clicking on the selected option again.
74return (
75<div className="container">
76<div className="image-frame"></div>
77<div className="content">
78<h1>Side School Seminar</h1>
206position: relative;
207}
208.image-frame {
209width: 100%;
210height: 300px;
211background-image: url('https://media.discordapp.net/attachments/1210186058440900690/1276662221681852446/paKC1TADWHlq2ilOrkbiQNwIbw.png?ex=66cc5218&is=66cb0098&hm=9e97febd99094480aa2c113488311f23db3c2d43af69c607212b05e55b794433&=&format=webp&quality=lossless&width=662&height=936');
212background-size: cover;
213background-position: center;
218functions where possible. Unless specified, don't add error handling,
219make sure that errors bubble up to the caller.
220Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
221not practical for the user's request (e.g. if they ask for a particular animated gif).
222If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
280functions where possible. Unless specified, don't add error handling,
281make sure that errors bubble up to the caller.
282Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
283not practical for the user's request (e.g. if they ask for a particular animated gif).
284If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
315---
316
317Val Town comes with blob storage built-in. It allows for storing any data: text, JSON, images. You can access it via [\`std/blob\`](https://www.val.town/v/std/blob).
318
319Blob storage is scoped globally to your account. If you set a blob in one val, you can retrieve it by the same key in another val. It's backed by Cloudflare R2.
nasaImageDetailsmain.tsx6 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
23export const nasaImageDetails = async () => {
4const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
5let nasaImageHtml = nasaAPOD.hdurl
6? `<img width="100%" src="${nasaAPOD.hdurl}"/>`
7: nasaAPOD.media_type === "video"
8? `<iframe width="100%" height="100%" src="${nasaAPOD.url}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`
9: `<p>Unknown Type</p><br/><code><pre>${JSON.stringify(nasaAPOD, null, 2)}</pre></code>`;
10nasaImageHtml += `<p>${nasaAPOD.explanation}</p>`;
11nasaImageHtml += "<p>"
12+ (nasaAPOD.media_type === "video"
13? `<small>Video Url: ${nasaAPOD.url}</small>`
14: `<p><small>Image Url: ${nasaAPOD.hdurl}</small>`)
15+ "</p>";
16return { html: nasaImageHtml, nasaAPOD };
17};
248"Use modern CSS techniques",
249"Add client-side form validation",
250"Implement lazy loading for images",
251"Use CSS Grid for layout",
252"Use CSS flex for layout",
248"Use modern CSS techniques",
249"Add client-side form validation",
250"Implement lazy loading for images",
251"Use CSS Grid for layout",
252"Use CSS flex for layout",
codingcanvasREADME.md1 match
7* Type text prompts, select it, press "Q". Select a previous generation with a new text prompt to keep iterating. Selecting shapes doesn't work yet. Have fun!
89<a href="https://x.com/JanPaul123/status/1815502582015754657"><img width=500 src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/5893dfbf-c2de-4be0-049e-d8fdd1970a00/public"/></a>
10
multiplayerCirclesREADME.md1 match
3Move circles around. State is synced with the server. Open a window in another tab and watch the circles update as you move them .
45
6
blob_adminREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Use this button to install the val:
getContentFromUrlmain.tsx2 matches
2324const headers = {
25...(opts.withImagesSummary && { 'X-With-Images-Summary': 'true' }),
26...(opts.withGeneratedAlt && { 'X-With-Generated-Alt': 'true' }),
27...(opts.withLinksSummary && { 'X-With-Links-Summary': 'true' }),
258const requestOptions = {
259returnFormat: optsArray.includes('html') ? 'html' : optsArray.includes('json') ? 'json' : undefined,
260withImagesSummary: optsArray.includes('images'),
261withLinksSummary: optsArray.includes('links'),
262withGeneratedAlt: optsArray.includes('caption')
czarkowyEdytorDatmain.tsx19 matches
1/**
2* This app allows users to drop an image onto the canvas, add text to it, move the text around,
3* edit the text directly on the canvas, and save the result to their local disk.
4* We'll use the HTML5 Canvas API for image manipulation and the File System Access API for saving files.
5* The app is styled with a playful and colorful design, using the Caveat font for a handwritten feel.
6*/
1112function App() {
13const [image, setImage] = useState(null);
14const [text, setText] = useState("Enter text here");
15const [textPosition, setTextPosition] = useState({ x: 250, y: 250 });
25window.addEventListener('resize', handleResize);
26return () => window.removeEventListener('resize', handleResize);
27}, [image, text, textPosition, canvasSize, textColor, fontSize, fontFamily]);
2829const handleResize = () => {
30if (!image) {
31setCanvasSize({ width: window.innerWidth, height: window.innerHeight });
32}
38ctx.clearRect(0, 0, canvas.width, canvas.height);
39
40if (image) {
41ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
42} else {
43ctx.fillStyle = "#f0f0f0";
46ctx.font = "20px Caveat";
47ctx.textAlign = "center";
48ctx.fillText("Drop an image here", canvas.width / 2, canvas.height / 2);
49}
5095e.preventDefault();
96const file = e.dataTransfer.files[0];
97if (file && file.type.startsWith('image/')) {
98const reader = new FileReader();
99reader.onload = (event) => {
100const img = new Image();
101img.onload = () => {
102setImage(img);
103const aspectRatio = img.width / img.height;
104let newWidth = Math.min(window.innerWidth, img.width);
123const handleSave = async () => {
124try {
125const blob = await new Promise(resolve => canvasRef.current.toBlob(resolve, 'image/png'));
126const handle = await window.showSaveFilePicker({
127suggestedName: 'image-with-text.png',
128types: [{
129description: 'PNG Files',
130accept: {'image/png': ['.png']},
131}],
132});
134await writable.write(blob);
135await writable.close();
136console.log('Image saved successfully!');
137} catch (err) {
138console.error('Error saving the image:', err);
139console.log('Failed to save the image. Please try again.');
140}
141};
169<option value="Courier New">Courier New</option>
170</select>
171<button onClick={handleSave} disabled={!image} className="save-button">
172Save Image with Text
173</button>
174<a href={import.meta.url.replace("esm.town", "val.town")} className="source-link">View Source</a>