mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-04 09:42:02 +08:00
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { Switch } from '@heroui/switch';
|
|
import clsx from 'clsx';
|
|
import React, { forwardRef } from 'react';
|
|
|
|
export interface SwitchCardProps {
|
|
label?: string
|
|
description?: string
|
|
value?: boolean
|
|
onValueChange?: (value: boolean) => void
|
|
name?: string
|
|
onBlur?: React.FocusEventHandler
|
|
disabled?: boolean
|
|
onChange?: React.ChangeEventHandler<HTMLInputElement>
|
|
}
|
|
|
|
const SwitchCard = forwardRef<HTMLInputElement, SwitchCardProps>(
|
|
(props, ref) => {
|
|
const { label, description, value, onValueChange, disabled } = props;
|
|
const selectString = value ? 'true' : 'false';
|
|
|
|
return (
|
|
<Switch
|
|
classNames={{
|
|
base: clsx(
|
|
'inline-flex flex-row-reverse w-full max-w-md bg-content1 hover:bg-content2 items-center',
|
|
'justify-between cursor-pointer rounded-lg gap-2 p-3 border-2 border-transparent',
|
|
'data-[selected=true]:border-primary bg-opacity-50 backdrop-blur-sm'
|
|
),
|
|
}}
|
|
{...props}
|
|
ref={ref}
|
|
isDisabled={disabled}
|
|
isSelected={value}
|
|
value={selectString}
|
|
onValueChange={onValueChange}
|
|
>
|
|
<div className='flex flex-col gap-1'>
|
|
<p className='text-medium'>{label}</p>
|
|
<p className='text-tiny text-default-400'>{description}</p>
|
|
</div>
|
|
</Switch>
|
|
);
|
|
}
|
|
);
|
|
|
|
SwitchCard.displayName = 'SwitchCard';
|
|
|
|
export default SwitchCard;
|