feat: font size to text panel
This commit is contained in:
@ -10,6 +10,8 @@ import {
|
|||||||
import { FONT_OPTIONS, FontFamily } from "@/constants/font-constants";
|
import { FONT_OPTIONS, FontFamily } from "@/constants/font-constants";
|
||||||
import { TextElement } from "@/types/timeline";
|
import { TextElement } from "@/types/timeline";
|
||||||
import { useTimelineStore } from "@/stores/timeline-store";
|
import { useTimelineStore } from "@/stores/timeline-store";
|
||||||
|
import { Slider } from "@/components/ui/slider";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
|
||||||
export function TextProperties({
|
export function TextProperties({
|
||||||
element,
|
element,
|
||||||
@ -50,6 +52,34 @@ export function TextProperties({
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<Label className="text-xs">Font size</Label>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Slider
|
||||||
|
defaultValue={[element.fontSize]}
|
||||||
|
min={8}
|
||||||
|
max={200}
|
||||||
|
step={1}
|
||||||
|
onValueChange={([value]) =>
|
||||||
|
updateTextElement(trackId, element.id, { fontSize: value })
|
||||||
|
}
|
||||||
|
className="w-full"
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={element.fontSize}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateTextElement(trackId, element.id, {
|
||||||
|
fontSize: parseInt(e.target.value),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
className="w-12 !text-xs h-7 rounded-sm text-center
|
||||||
|
[appearance:textfield]
|
||||||
|
[&::-webkit-outer-spin-button]:appearance-none
|
||||||
|
[&::-webkit-inner-spin-button]:appearance-none"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,7 @@ interface InputProps extends React.ComponentProps<"input"> {
|
|||||||
|
|
||||||
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
(
|
(
|
||||||
{
|
{ className, type, showPassword, onShowPasswordChange, value, ...props },
|
||||||
className,
|
|
||||||
type,
|
|
||||||
showPassword,
|
|
||||||
onShowPasswordChange,
|
|
||||||
value,
|
|
||||||
...props
|
|
||||||
},
|
|
||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
const isPassword = type === "password";
|
const isPassword = type === "password";
|
||||||
@ -26,7 +19,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|||||||
const inputType = isPassword && showPassword ? "text" : type;
|
const inputType = isPassword && showPassword ? "text" : type;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full">
|
<div className={showPassword ? "relative w-full" : ""}>
|
||||||
<input
|
<input
|
||||||
type={inputType}
|
type={inputType}
|
||||||
className={cn(
|
className={cn(
|
||||||
|
Reference in New Issue
Block a user