Skip to content

Commit

Permalink
Improve astro demo
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Nov 7, 2022
1 parent ab35386 commit d771b7d
Show file tree
Hide file tree
Showing 24 changed files with 528 additions and 284 deletions.
2 changes: 1 addition & 1 deletion playground/astro/astro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineConfig({
plugins: [
inspect(),
whyframe({
defaultSrc: '/frames/basic',
defaultSrc: '/frames/default',
components: [{ name: 'Story', showSource: true }]
}),
whyframeAstro({
Expand Down
1 change: 0 additions & 1 deletion playground/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@whyframe/svelte": "^0.1.5",
"@whyframe/vue": "^0.1.3",
"astro": "^1.6.3",
"preact-render-to-string": "^5.2.6",
"svelte": "^3.52.0",
"vite-plugin-inspect": "^0.7.7"
}
Expand Down
1 change: 1 addition & 0 deletions playground/astro/public/astro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions playground/astro/src/assets/whyframe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 0 additions & 21 deletions playground/astro/src/components/Counter.module.css

This file was deleted.

46 changes: 0 additions & 46 deletions playground/astro/src/components/Counter.svelte

This file was deleted.

51 changes: 0 additions & 51 deletions playground/astro/src/components/Counter.vue

This file was deleted.

23 changes: 0 additions & 23 deletions playground/astro/src/components/CounterPreact.jsx

This file was deleted.

23 changes: 0 additions & 23 deletions playground/astro/src/components/CounterReact.jsx

This file was deleted.

24 changes: 0 additions & 24 deletions playground/astro/src/components/CounterSolid.jsx

This file was deleted.

44 changes: 44 additions & 0 deletions playground/astro/src/components/Popup.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.activator {
display: block;
border-radius: 8px;
border: 1px solid transparent;
padding: 0.5em 1em;
font-size: 0.9em;
font-weight: 500;
font-family: inherit;
color: #efefef;
background-color: #1e1e1e;
cursor: pointer;
transition: border-color 0.25s;
}

.activator:hover {
border-color: #ffed24;
}

.activator:focus,
.activator:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}

.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
background-color: #090909;
color: #efefef;
font-size: 1.5rem;
opacity: 0.8;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
}

.background:focus,
.background:focus-visible {
border: 4px solid #ffed24;
}
67 changes: 67 additions & 0 deletions playground/astro/src/components/Popup.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<script>
/** @type {string} */
export let content
let open = false
</script>

<button
class="activator"
aria-haspopup="dialog"
on:click={() => (open = !open)}
>
<slot />
</button>

{#if open}
<button class="background" on:click={() => (open = false)}>
<p>{content}</p>
</button>
{/if}

<style>
.activator {
display: block;
border-radius: 8px;
border: 1px solid transparent;
padding: 0.5em 1em;
font-size: 0.9em;
font-weight: 500;
font-family: inherit;
color: #efefef;
background-color: #1e1e1e;
cursor: pointer;
transition: border-color 0.25s;
}
.activator:hover {
border-color: #ffed24;
}
.activator:focus,
.activator:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
background-color: #090909;
color: #efefef;
font-size: 1.5rem;
opacity: 0.8;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
}
.background:focus,
.background:focus-visible {
border: 4px solid #ffed24;
}
</style>
69 changes: 69 additions & 0 deletions playground/astro/src/components/Popup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<script setup>
import { ref } from 'vue'
defineProps({
content: {
type: String,
required: true
}
})
const open = ref(false)
</script>

<template>
<button class="activator" aria-haspopup="dialog" @click="open = !open">
<slot />
</button>

<button v-show="open" class="background" @click="open = false">
<p>{{ content }}</p>
</button>
</template>

<style scoped>
.activator {
display: block;
border-radius: 8px;
border: 1px solid transparent;
padding: 0.5em 1em;
font-size: 0.9em;
font-weight: 500;
font-family: inherit;
color: #efefef;
background-color: #1e1e1e;
cursor: pointer;
transition: border-color 0.25s;
}
.activator:hover {
border-color: #ffed24;
}
.activator:focus,
.activator:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
background-color: #090909;
color: #efefef;
font-size: 1.5rem;
opacity: 0.8;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
}
.background:focus,
.background:focus-visible {
border: 4px solid #ffed24;
}
</style>
Loading

0 comments on commit d771b7d

Please sign in to comment.