feat(switch-toggle-component): Switch/Toggle mit slide-Animation [tsc:fail]
This commit is contained in:
parent
aec1d96e66
commit
6eb9428c2e
@ -1,8 +1,9 @@
|
||||
{
|
||||
"completed_features": [],
|
||||
"current_feature": "checkbox-component",
|
||||
"current_feature": "switch-toggle-component",
|
||||
"started_at": "2026-05-23T09:53:25.616963",
|
||||
"attempted_features": [
|
||||
"dropdown-menu-component"
|
||||
"dropdown-menu-component",
|
||||
"checkbox-component"
|
||||
]
|
||||
}
|
||||
@ -3834,3 +3834,21 @@ src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
||||
- `09:53:55` **INFO** Committed feature checkbox-component
|
||||
- `09:53:55` **INFO** Pushed: rc=0
|
||||
|
||||
## Phase-3 Feature: switch-toggle-component (2026-05-23 09:53:55)
|
||||
|
||||
- `09:53:55` **INFO** Description: Switch/Toggle mit slide-Animation
|
||||
- `09:53:55` **INFO** Generating apps/web/src/components/Switch.tsx (Switch-Component. Props: checked, onChange, label?, size?: 'sm'|'md'. …)
|
||||
- `09:54:09` **INFO** wrote 1506 chars in 14.0s (attempt 1)
|
||||
- `09:54:09` **INFO** Running tsc --noEmit on api…
|
||||
- `09:54:11` **WARN** tsc errors:
|
||||
src/db/schema.ts(37,14): error TS7022: 'customers' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
src/db/schema.ts(45,59): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
|
||||
src/db/schema.ts(49,14): error TS7022: 'projects' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
||||
src/db/schema.ts(53,56): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
|
||||
src/index.ts(27,25): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
|
||||
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
||||
|
||||
57
apps/web/src/components/Switch.tsx
Normal file
57
apps/web/src/components/Switch.tsx
Normal file
@ -0,0 +1,57 @@
|
||||
import React from 'react';
|
||||
|
||||
interface SwitchProps {
|
||||
checked: boolean;
|
||||
onChange: (checked: boolean) => void;
|
||||
label?: string;
|
||||
size?: 'sm' | 'md';
|
||||
}
|
||||
|
||||
const Switch: React.FC<SwitchProps> = ({
|
||||
checked,
|
||||
onChange,
|
||||
label,
|
||||
size = 'md'
|
||||
}) => {
|
||||
const sizeClasses = {
|
||||
sm: {
|
||||
container: 'w-8 h-4',
|
||||
thumb: 'w-3 h-3',
|
||||
translate: checked ? 'translate-x-4' : 'translate-x-0',
|
||||
},
|
||||
md: {
|
||||
container: 'w-11 h-6',
|
||||
thumb: 'w-5 h-5',
|
||||
translate: checked ? 'translate-x-5' : 'translate-x-0',
|
||||
},
|
||||
};
|
||||
|
||||
const currentSize = sizeClasses[size];
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-3">
|
||||
{label && <span className="text-sm font-medium text-zinc-700">{label}</span>}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onChange(!checked)}
|
||||
className={`
|
||||
relative inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
||||
${currentSize.container}
|
||||
${checked ? 'bg-blue-600' : 'bg-zinc-300'}
|
||||
`}
|
||||
role="switch"
|
||||
aria-checked={checked}
|
||||
>
|
||||
<span
|
||||
className={`
|
||||
pointer-events-none inline-block rounded-full bg-white shadow-lg ring-0 transition-transform duration-200 ease-in-out
|
||||
${currentSize.thumb}
|
||||
${currentSize.translate}
|
||||
`}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Switch;
|
||||
Loading…
Reference in New Issue
Block a user