feat: dashboard v2, esm, upgrades (#211)
* esm * wip * wip * wip * wip * wip * wip * subscription notice * wip * wip * wip * fix envs * fix: update docker build * fix * esm/types * delete dashboard :D * add patches to dockerfiles * update packages + catalogs + ts * wip * remove native libs * ts * improvements * fix redirects and fetching session * try fix favicon * fixes * fix * order and resize reportds within a dashboard * improvements * wip * added userjot to dashboard * fix * add op * wip * different cache key * improve date picker * fix table * event details loading * redo onboarding completely * fix login * fix * fix * extend session, billing and improve bars * fix * reduce price on 10M
This commit is contained in:
committed by
GitHub
parent
436e81ecc9
commit
81a7e5d62e
68
apps/start/src/components/forms/input-with-label.tsx
Normal file
68
apps/start/src/components/forms/input-with-label.tsx
Normal file
@@ -0,0 +1,68 @@
|
||||
import { BanIcon, InfoIcon } from 'lucide-react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { Input } from '../ui/input';
|
||||
import type { InputProps } from '../ui/input';
|
||||
import { Label } from '../ui/label';
|
||||
import { Tooltiper } from '../ui/tooltip';
|
||||
|
||||
type WithLabel = {
|
||||
children: React.ReactNode;
|
||||
label: string;
|
||||
error?: string | undefined;
|
||||
info?: React.ReactNode;
|
||||
className?: string;
|
||||
};
|
||||
type InputWithLabelProps = InputProps & Omit<WithLabel, 'children'>;
|
||||
|
||||
export const WithLabel = ({
|
||||
children,
|
||||
className,
|
||||
label,
|
||||
info,
|
||||
error,
|
||||
}: WithLabel) => {
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className="mb-2 flex items-end justify-between">
|
||||
<Label
|
||||
className="mb-0 flex flex-1 shrink-0 items-center gap-1 whitespace-nowrap"
|
||||
htmlFor={label}
|
||||
>
|
||||
{label}
|
||||
{info && (
|
||||
<Tooltiper content={info}>
|
||||
<InfoIcon size={14} />
|
||||
</Tooltiper>
|
||||
)}
|
||||
</Label>
|
||||
{error && (
|
||||
<Tooltiper
|
||||
asChild
|
||||
content={error}
|
||||
tooltipClassName="max-w-80 leading-normal"
|
||||
align="end"
|
||||
>
|
||||
<div className="flex items-center gap-1 leading-none text-destructive">
|
||||
Issues
|
||||
<BanIcon size={14} />
|
||||
</div>
|
||||
</Tooltiper>
|
||||
)}
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const InputWithLabel = forwardRef<HTMLInputElement, InputWithLabelProps>(
|
||||
(props, ref) => {
|
||||
return (
|
||||
<WithLabel {...props}>
|
||||
<Input ref={ref} id={props.label} {...props} />
|
||||
</WithLabel>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
InputWithLabel.displayName = 'InputWithLabel';
|
||||
Reference in New Issue
Block a user