built basic ui structure in /hierarchy
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createSignal } from "solid-js";
|
||||
import { Popover } from "@kobalte/core";
|
||||
|
||||
export function SolidApp(props) {
|
||||
// Local state for optimistic updates or other UI-only logic
|
||||
@@ -14,33 +15,61 @@ export function SolidApp(props) {
|
||||
props.push("decrement", {});
|
||||
};
|
||||
|
||||
// Reset updating flag when state changes from server
|
||||
// (In a real app, you might use a more sophisticated approach)
|
||||
|
||||
return (
|
||||
<div class="p-6 border-2 border-blue-500 rounded-lg bg-white shadow-md">
|
||||
<h2 class="text-xl font-semibold text-blue-700 mb-4">Solid.js Component</h2>
|
||||
<div class="p-6 border-2 border-blue-500 rounded-2xl bg-white shadow-xl max-w-sm mx-auto">
|
||||
<h2 class="text-2xl font-black text-blue-700 mb-6 tracking-tight">Solid + Kobalte</h2>
|
||||
|
||||
<div class="flex items-center justify-between mb-8 p-4 bg-slate-50 rounded-xl border border-slate-100">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs font-bold text-slate-400 uppercase tracking-widest">Current Count</span>
|
||||
<span class="text-5xl font-black text-slate-900">{props.state.count}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-4 mb-6">
|
||||
<span class="text-4xl font-bold">{props.state.count}</span>
|
||||
<div class="flex flex-col space-y-2">
|
||||
<button
|
||||
onClick={increment}
|
||||
class="px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600 transition-colors"
|
||||
class="w-12 h-12 bg-indigo-600 text-white rounded-full flex items-center justify-center hover:bg-indigo-700 transition-all active:scale-90 shadow-lg shadow-indigo-200"
|
||||
>
|
||||
Increment
|
||||
<span class="text-2xl">+</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={decrement}
|
||||
class="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600 transition-colors"
|
||||
class="w-12 h-12 bg-slate-200 text-slate-600 rounded-full flex items-center justify-center hover:bg-slate-300 transition-all active:scale-90"
|
||||
>
|
||||
Decrement
|
||||
<span class="text-2xl">−</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-sm text-gray-500 italic">
|
||||
This UI is rendered by Solid.js. Changes are synced back to Elixir via push_event.
|
||||
<div class="flex justify-center">
|
||||
<Popover.Root>
|
||||
<Popover.Trigger class="px-6 py-2.5 bg-slate-900 text-white text-sm font-bold rounded-full hover:bg-slate-800 transition-colors flex items-center space-x-2">
|
||||
<span>Kobalte Info</span>
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
</Popover.Trigger>
|
||||
<Popover.Portal>
|
||||
<Popover.Content class="z-50 w-64 p-4 bg-white rounded-xl shadow-2xl border border-slate-100 animate-in fade-in zoom-in-95 duration-200 origin-top">
|
||||
<Popover.Arrow class="text-white fill-current" />
|
||||
<div class="flex flex-col">
|
||||
<Popover.Title class="text-sm font-bold text-slate-900 mb-1">Kobalte Logic</Popover.Title>
|
||||
<Popover.Description class="text-xs text-slate-500 leading-relaxed">
|
||||
Kobalte is a headless UI toolkit for Solid.js. It provides the logic while you provide the styles!
|
||||
</Popover.Description>
|
||||
<Popover.CloseButton class="absolute top-2 right-2 text-slate-400 hover:text-slate-600">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</Popover.CloseButton>
|
||||
</div>
|
||||
</Popover.Content>
|
||||
</Popover.Portal>
|
||||
</Popover.Root>
|
||||
</div>
|
||||
|
||||
<p class="mt-8 text-[10px] text-slate-400 font-bold uppercase tracking-tighter text-center">
|
||||
Bridge: Phoenix LiveView ↔ Solid.js
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user