feat: start switching to blaze and svelte
This commit is contained in:
16
examples/gift_card/src/lib/components/Button.svelte
Normal file
16
examples/gift_card/src/lib/components/Button.svelte
Normal file
@@ -0,0 +1,16 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements';
|
||||
|
||||
interface Props extends HTMLButtonAttributes {
|
||||
children: Snippet;
|
||||
}
|
||||
|
||||
let { children, ...props }: Props = $props();
|
||||
</script>
|
||||
|
||||
<button
|
||||
{...props}
|
||||
class="group inline-flex items-center justify-center rounded-full bg-blue-600 px-4 py-2 text-sm font-semibold text-white hover:bg-blue-500 focus:outline-none active:bg-blue-800 active:text-blue-100"
|
||||
>{@render children()}</button
|
||||
>
|
||||
21
examples/gift_card/src/lib/components/Input.svelte
Normal file
21
examples/gift_card/src/lib/components/Input.svelte
Normal file
@@ -0,0 +1,21 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { HTMLInputAttributes } from 'svelte/elements';
|
||||
|
||||
interface Props extends HTMLInputAttributes {
|
||||
children: Snippet<[]>;
|
||||
}
|
||||
|
||||
let { id, children, ...props }: Props = $props();
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<label for={id} class="mb-3 block text-sm font-medium text-gray-700">
|
||||
{@render children()}
|
||||
</label>
|
||||
<input
|
||||
{...props}
|
||||
{id}
|
||||
class="block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm"
|
||||
/>
|
||||
</div>
|
||||
1
examples/gift_card/src/lib/index.ts
Normal file
1
examples/gift_card/src/lib/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
17
examples/gift_card/src/lib/utils.ts
Normal file
17
examples/gift_card/src/lib/utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import blueprint from '../../plutus.json' assert { type: 'json' };
|
||||
|
||||
export type Validators = {
|
||||
giftCard: string;
|
||||
};
|
||||
|
||||
export function readValidators(): Validators {
|
||||
const giftCard = blueprint.validators.find((v) => v.title === 'oneshot.gift_card.spend');
|
||||
|
||||
if (!giftCard) {
|
||||
throw new Error('Gift Card validator not found');
|
||||
}
|
||||
|
||||
return {
|
||||
giftCard: giftCard.compiledCode
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user