├── .gitignore ├── .npmrc ├── .vscode ├── extensions.json └── launch.json ├── package.json └── qr-code ├── README.md ├── astro.config.mjs ├── functions ├── [[path]].js └── api │ └── generate-qr.js ├── package.json ├── public ├── favicon.png ├── favicon.svg └── image-qr-code.png ├── src ├── components │ └── Card.astro ├── env.d.ts ├── layouts │ └── Layout.astro └── pages │ └── index.astro ├── tailwind.config.cjs └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | **/dist/ 3 | **/.output/ 4 | 5 | # dependencies 6 | **/node_modules/ 7 | **/package-lock.json 8 | 9 | # logs 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # environment variables 16 | .env 17 | .env.production 18 | 19 | # macOS-specific files 20 | .DS_Store 21 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # Expose Astro dependencies for `pnpm` users 2 | shamefully-hoist=true 3 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["astro-build.astro-vscode"], 3 | "unwantedRecommendations": [] 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "./node_modules/.bin/astro dev", 6 | "name": "Development server", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midudev/frontend-mentor-challenges/9de7dbbc38baa23dac13ee1fa72a52cc6f584aa1/package.json -------------------------------------------------------------------------------- /qr-code/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to [Astro](https://astro.build) 2 | 3 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) 4 | 5 | > 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! 6 | 7 | ![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png) 8 | 9 | 10 | ## 🚀 Project Structure 11 | 12 | Inside of your Astro project, you'll see the following folders and files: 13 | 14 | ``` 15 | / 16 | ├── public/ 17 | │ └── favicon.svg 18 | ├── src/ 19 | │ ├── components/ 20 | │ │ └── Card.astro 21 | │ ├── layouts/ 22 | │ │ └── Layout.astro 23 | │ └── pages/ 24 | │ └── index.astro 25 | └── package.json 26 | ``` 27 | 28 | Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. 29 | 30 | There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. 31 | 32 | Any static assets, like images, can be placed in the `public/` directory. 33 | 34 | ## 🧞 Commands 35 | 36 | All commands are run from the root of the project, from a terminal: 37 | 38 | | Command | Action | 39 | | :--------------------- | :------------------------------------------------- | 40 | | `npm install` | Installs dependencies | 41 | | `npm run dev` | Starts local dev server at `localhost:3000` | 42 | | `npm run build` | Build your production site to `./dist/` | 43 | | `npm run preview` | Preview your build locally, before deploying | 44 | | `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` | 45 | | `npm run astro --help` | Get help using the Astro CLI | 46 | 47 | ## 👀 Want to learn more? 48 | 49 | Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). 50 | -------------------------------------------------------------------------------- /qr-code/astro.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'astro/config'; 2 | import tailwind from "@astrojs/tailwind"; 3 | 4 | import cloudflare from "@astrojs/cloudflare"; 5 | 6 | // https://astro.build/config 7 | export default defineConfig({ 8 | integrations: [tailwind()], 9 | output: "server", 10 | adapter: cloudflare({ mode: "directory" }) 11 | }); -------------------------------------------------------------------------------- /qr-code/functions/[[path]].js: -------------------------------------------------------------------------------- 1 | globalThis.process = { 2 | argv: [], 3 | env: {}, 4 | }; 5 | globalThis.process={argv:[],env:{}};function de(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e{throw new Error("Deprecated: Astro.fetchContent() has been replaced with Astro.glob().")}}function Wt(){return(a,i)=>{let n=[...Object.values(a)];if(n.length===0)throw new Error(`Astro.glob(${JSON.stringify(i())}) - no matches found.`);return Promise.all(n.map(o=>o()))}}function rt(e,a,i){let n=a?new URL(a):void 0,o=new URL(e,"http://localhost"),r=new URL(i);return{site:n,generator:`Astro v${Bt}`,fetchContent:Ht(),glob:Wt(),resolve(...t){let s=t.reduce((p,l)=>new URL(l,p),o).pathname;return s.startsWith(r.pathname)&&(s="/"+s.slice(r.pathname.length)),s}}}function Jt(e,a){if(e[a])return e[a];if(a==="delete"&&e.del)return e.del;if(e.all)return e.all}async function Vt(e,a,i){var n;let o=(n=a.method)==null?void 0:n.toLowerCase(),r=Jt(e,o);if(!r||typeof r!="function")throw new Error(`Endpoint handler not found! Expected an exported function for "${o}"`);r.length>1&&console.warn(` 6 | API routes with 2 arguments have been deprecated. Instead they take a single argument in the form of: 7 | 8 | export function get({ params, request }) { 9 | //... 10 | } 11 | 12 | Update your code to remove this warning.`);let t={request:a,params:i},s=new Proxy(t,{get(p,l){return l in p?Reflect.get(p,l):l in i?(console.warn(` 13 | API routes no longer pass params as the first argument. Instead an object containing a params property is provided in the form of: 14 | 15 | export function get({ params }) { 16 | // ... 17 | } 18 | 19 | Update your code to remove this warning.`),Reflect.get(i,l)):void 0}});return r.call(e,s,a)}var{replace:Yt}="",Gt=/[&<>'"]/g,Kt={"&":"&","<":"<",">":">","'":"'",'"':"""},Xt=e=>Kt[e],Zt=e=>Yt.call(e,Gt,Xt),ie=Zt,T=class extends String{},h=e=>e instanceof T?e:typeof e=="string"?new T(e):e,Ae=class{constructor(a,i){this.modules=i.modules,this.hoisted=i.hoisted,this.hydratedComponents=i.hydratedComponents,this.clientOnlyComponents=i.clientOnlyComponents,this.hydrationDirectives=i.hydrationDirectives,this.mockURL=new URL(a,"http://example.com"),this.metadataCache=new Map}resolvePath(a){if(a.startsWith(".")){let i=new URL(a,this.mockURL).pathname;return i.startsWith("/@fs")&&i.endsWith(".jsx")?i.slice(0,i.length-4):i}return a}getPath(a){let i=this.getComponentMetadata(a);return i?.componentUrl||null}getExport(a){let i=this.getComponentMetadata(a);return i?.componentExport||null}getComponentMetadata(a){if(this.metadataCache.has(a))return this.metadataCache.get(a);let i=this.findComponentMetadata(a);return this.metadataCache.set(a,i),i}findComponentMetadata(a){let i=typeof a=="string";for(let{module:n,specifier:o}of this.modules){let r=this.resolvePath(o);for(let[t,s]of Object.entries(n))if(i){if(t==="tagName"&&a===s)return{componentExport:t,componentUrl:r}}else if(a===s)return{componentExport:t,componentUrl:r}}return null}};function st(e,a){return new Ae(e,a)}var $={Value:0,JSON:1,RegExp:2,Date:3,Map:4,Set:5,BigInt:6,URL:7};function ue(e,a={},i=new WeakSet){if(i.has(e))throw new Error(`Cyclic reference detected while serializing props for <${a.displayName} client:${a.hydrate}>! 20 | 21 | Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);i.add(e);let n=e.map(o=>lt(o,a,i));return i.delete(e),n}function pt(e,a={},i=new WeakSet){if(i.has(e))throw new Error(`Cyclic reference detected while serializing props for <${a.displayName} client:${a.hydrate}>! 22 | 23 | Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);i.add(e);let n=Object.fromEntries(Object.entries(e).map(([o,r])=>[o,lt(r,a,i)]));return i.delete(e),n}function lt(e,a={},i=new WeakSet){switch(Object.prototype.toString.call(e)){case"[object Date]":return[$.Date,e.toISOString()];case"[object RegExp]":return[$.RegExp,e.source];case"[object Map]":return[$.Map,JSON.stringify(ue(Array.from(e),a,i))];case"[object Set]":return[$.Set,JSON.stringify(ue(Array.from(e),a,i))];case"[object BigInt]":return[$.BigInt,e.toString()];case"[object URL]":return[$.URL,e.toString()];case"[object Array]":return[$.JSON,JSON.stringify(ue(e,a,i))];default:return e!==null&&typeof e=="object"?[$.Value,pt(e,a,i)]:[$.Value,e]}}function ct(e,a){return JSON.stringify(pt(e,a))}function dt(e){let a={};return i(e),Object.keys(a).join(" ");function i(n){n&&typeof n.forEach=="function"?n.forEach(i):n===Object(n)?Object.keys(n).forEach(o=>{n[o]&&i(o)}):(n=n===!1||n==null?"":String(n).trim(),n&&n.split(/\s+/).forEach(o=>{a[o]=!0}))}}var mt=["load","idle","media","visible","only"],Qt=new Set(mt),ft=new Set(mt.map(e=>`client:${e}`));function ea(e){let a={isPage:!1,hydration:null,props:{}};for(let[i,n]of Object.entries(e))if(i.startsWith("server:")&&i==="server:root"&&(a.isPage=!0),i.startsWith("client:"))switch(a.hydration||(a.hydration={directive:"",value:"",componentUrl:"",componentExport:{value:""}}),i){case"client:component-path":{a.hydration.componentUrl=n;break}case"client:component-export":{a.hydration.componentExport.value=n;break}case"client:component-hydration":break;case"client:display-name":break;default:{if(a.hydration.directive=i.split(":")[1],a.hydration.value=n,!Qt.has(a.hydration.directive))throw new Error(`Error: invalid hydration directive "${i}". Supported hydration methods: ${Array.from(ft).join(", ")}`);if(a.hydration.directive==="media"&&typeof a.hydration.value!="string")throw new Error('Error: Media query must be provided for "client:media", similar to client:media="(max-width: 600px)"');break}}else i==="class:list"?a.props[i.slice(0,-5)]=dt(n):a.props[i]=n;return a}async function ta(e,a){let{renderer:i,result:n,astroId:o,props:r,attrs:t}=e,{hydrate:s,componentUrl:p,componentExport:l}=a;if(!l.value)throw new Error(`Unable to resolve a valid export for "${a.displayName}"! Please open an issue at https://astro.build/issues!`);let d={children:"",props:{uid:o}};if(t)for(let[c,x]of Object.entries(t))d.props[c]=x;return d.props["component-url"]=await n.resolve(decodeURI(p)),i.clientEntrypoint&&(d.props["component-export"]=l.value,d.props["renderer-url"]=await n.resolve(decodeURI(i.clientEntrypoint)),d.props.props=ie(ct(r,a))),d.props.ssr="",d.props.client=s,d.props["before-hydration-url"]=await n.resolve("astro:scripts/before-hydration.js"),d.props.opts=ie(JSON.stringify({name:a.displayName,value:a.hydrateArgs||""})),d}var aa='(self.Astro=self.Astro||{}).idle=t=>{const e=async()=>{await(await t())()};"requestIdleCallback"in window?window.requestIdleCallback(e):setTimeout(e,200)},window.dispatchEvent(new Event("astro:idle"));',ia='(self.Astro=self.Astro||{}).load=a=>{(async()=>await(await a())())()},window.dispatchEvent(new Event("astro:load"));',na='(self.Astro=self.Astro||{}).media=(s,a)=>{const t=async()=>{await(await s())()};if(a.value){const e=matchMedia(a.value);e.matches?t():e.addEventListener("change",t,{once:!0})}},window.dispatchEvent(new Event("astro:media"));',oa='(self.Astro=self.Astro||{}).only=t=>{(async()=>await(await t())())()},window.dispatchEvent(new Event("astro:only"));',ra='(self.Astro=self.Astro||{}).visible=(s,c,n)=>{const r=async()=>{await(await s())()};let i=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){i.disconnect(),r();break}});for(let e=0;eastro-island,astro-slot{display:contents} 46 | -------------------------------------------------------------------------------- /qr-code/tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [], 8 | } 9 | -------------------------------------------------------------------------------- /qr-code/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "astro/tsconfigs/base" 3 | } 4 | --------------------------------------------------------------------------------