Updated components

This commit is contained in:
Patrick Alvin Alcala 2025-12-18 17:15:53 +08:00
parent 409a3891f9
commit f59032050e
12 changed files with 30 additions and 19 deletions

View file

@ -9,6 +9,7 @@ interface Props {
padding?: string padding?: string
background?: string background?: string
width?: string width?: string
class?: string
} }
export default (props: Props) => { export default (props: Props) => {

View file

@ -1,7 +1,8 @@
import './Button.sass' import './Button.sass'
import { Show, Switch, Match, type JSXElement } from 'solid-js' import type { JSXElement } from 'solid-js'
import { A } from '@solidjs/router'
import { Row } from '../index' import { Row } from '../index'
import { Show, Switch, Match } from 'solid-js/web'
interface Props { interface Props {
label?: string label?: string
@ -14,6 +15,9 @@ interface Props {
width?: number width?: number
wide?: boolean wide?: boolean
icon?: (props: { size?: number }) => JSXElement icon?: (props: { size?: number }) => JSXElement
children?: JSXElement
background?: string
color?: string
} }
const getBorderRadius = (edge: Props['edges']) => { const getBorderRadius = (edge: Props['edges']) => {
@ -37,24 +41,24 @@ export default (props: Props) => {
<Show when={props.to}> <Show when={props.to}>
<Switch> <Switch>
<Match when={props.design}> <Match when={props.design}>
<A href={props.to!} aria-label={props.label} target={props.newtab ? '_blank' : ''}> <a href={props.to!} aria-label={props.label} target={props.newtab ? '_blank' : ''}>
<button class={props.design} style={`${borderRadius}; width: ${props.wide ? '100%' : props.width}`}> <button class={props.design} style={`${borderRadius}; width: ${props.wide ? '100%' : props.width}`}>
<Show when={props.icon}> <Show when={props.icon}>
<span>{Icon && <Icon size={24} />}</span> <span>{Icon && <Icon size={24} />}</span>
</Show> </Show>
{props.label || 'Click Me!'} {props.label || 'Click Me!'}
</button> </button>
</A> </a>
</Match> </Match>
<Match when={!props.design}> <Match when={!props.design}>
<A href={props.to!} aria-label={props.label} target={props.newtab ? '_blank' : ''}> <a href={props.to!} aria-label={props.label} target={props.newtab ? '_blank' : ''}>
<button class="button" style={`${borderRadius}; width: ${props.wide ? '100%' : props.width}`}> <button class="button" style={`${borderRadius}; width: ${props.wide ? '100%' : props.width}`}>
<Show when={props.icon}> <Show when={props.icon}>
<span>{Icon && <Icon size={24} />}</span> <span>{Icon && <Icon size={24} />}</span>
</Show> </Show>
{props.label || 'Click Me!'} {props.label || 'Click Me!'}
</button> </button>
</A> </a>
</Match> </Match>
</Switch> </Switch>
</Show> </Show>

View file

@ -20,7 +20,7 @@ export default (props: Props) => {
placeholder={props.placeholder} placeholder={props.placeholder}
value={props.value} value={props.value}
onChange={props.onChange} onChange={props.onChange}
itemComponent={(props) => ( itemComponent={(props: any) => (
<Combobox.Item item={props.item} class="combobox__item"> <Combobox.Item item={props.item} class="combobox__item">
<Combobox.ItemLabel>{props.item.textValue}</Combobox.ItemLabel> <Combobox.ItemLabel>{props.item.textValue}</Combobox.ItemLabel>
<Combobox.ItemIndicator class="combobox__item-indicator"> <Combobox.ItemIndicator class="combobox__item-indicator">

View file

@ -1,5 +1,6 @@
import './Display.sass' import './Display.sass'
import { type JSXElement, Switch, Match } from 'solid-js' import { Switch, Match } from 'solid-js/web'
import type { JSXElement } from 'solid-js'
interface Props { interface Props {
children: JSXElement children: JSXElement

View file

@ -1,6 +1,7 @@
import './Input.sass' import './Input.sass'
import { TextField } from '@kobalte/core/text-field' import { TextField } from '@kobalte/core/text-field'
import { Show, type Setter } from 'solid-js' import { Show } from 'solid-js/web'
import type { Setter } from 'solid-js'
interface Props { interface Props {
label?: string label?: string

View file

@ -1,5 +1,5 @@
import './Link.sass' import './Link.sass'
import { A } from '@solidjs/router' // import { A } from '@solidjs/router'
interface Props { interface Props {
to: string to: string
@ -10,9 +10,9 @@ interface Props {
export default (props: Props) => { export default (props: Props) => {
return ( return (
<> <>
<A href={props.to} aria-label={`Go to ${props.to}`} target={props.newtab ? '_blank' : ''}> <a href={props.to} aria-label={`Go to ${props.to}`} target={props.newtab ? '_blank' : ''}>
{props.children} {props.children}
</A> </a>
</> </>
) )
} }

View file

@ -1,5 +1,6 @@
import './Modal.sass' import './Modal.sass'
import { type JSXElement, Show } from 'solid-js' import type { JSXElement } from 'solid-js'
import { Show } from 'solid-js/web'
interface Props { interface Props {
children: JSXElement children: JSXElement

View file

@ -1,5 +1,6 @@
import './Modal.sass' import './Modal.sass'
import { type JSXElement, Show, createSignal } from 'solid-js' import { type JSXElement, createSignal } from 'solid-js'
import { Show } from 'solid-js/web'
import Button from '../Button/Button' import Button from '../Button/Button'
interface Props { interface Props {

View file

@ -1,5 +1,5 @@
import './Page.sass' import './Page.sass'
import { Show } from 'solid-js' import { Show } from 'solid-js/web'
interface Props { interface Props {
children?: any children?: any

View file

@ -1,6 +1,7 @@
import './Radio.sass' import './Radio.sass'
import { RadioGroup } from '@kobalte/core/radio-group' import { RadioGroup } from '@kobalte/core/radio-group'
import { type Setter, For, Show } from 'solid-js' import { For, Show } from 'solid-js/web'
import type { Setter } from 'solid-js'
interface Props { interface Props {
label?: string label?: string
@ -19,7 +20,7 @@ export default (props: Props) => {
<div class="radio-group__items" role="presentation" style={`gap: ${props.gap || 1}rem`}> <div class="radio-group__items" role="presentation" style={`gap: ${props.gap || 1}rem`}>
<For each={props.data}> <For each={props.data}>
{(item) => ( {(item: any) => (
<RadioGroup.Item value={item} class="radio"> <RadioGroup.Item value={item} class="radio">
<RadioGroup.ItemInput class="radio__input" /> <RadioGroup.ItemInput class="radio__input" />
<RadioGroup.ItemControl class="radio__control"> <RadioGroup.ItemControl class="radio__control">

View file

@ -1,5 +1,6 @@
import './Row.sass' import './Row.sass'
import { Show, type JSXElement } from 'solid-js' import { Show } from 'solid-js/web'
import type { JSXElement } from 'solid-js'
interface Props { interface Props {
children: JSXElement children: JSXElement

View file

@ -55,7 +55,7 @@ export default () => {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{updatedList().map((item) => ( {updatedList().map((item: any) => (
<tr> <tr>
<td>{item.slice(0, 1)}</td> <td>{item.slice(0, 1)}</td>
</tr> </tr>