Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/features/authoring/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function ImageCreateMenu() {
return (
<>
<div className="dropdown">
<li>
<li className="tooltip tooltip-bottom" data-tip="Add image">
<a tabIndex={0}>
<ImageIcon size={16} />
</a>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/features/authoring/topbar/ShapeCreateMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function ShapeCreateMenu() {
return (
<>
<div className="dropdown">
<li>
<li className="tooltip tooltip-bottom" data-tip="Add shape">
<a tabIndex={0}>
<ShapesIcon size={16} />
</a>
Expand All @@ -28,22 +28,22 @@ function ShapeCreateMenu() {
tabIndex={0}
className="dropdown-content menu menu-horizontal bg-base-300 rounded-box z-1 p-2 shadow-sm top-[38px] w-max"
>
<li>
<li className="tooltip tooltip-bottom" data-tip="Box">
<a onClick={() => switchCreate("box")}>
<VectorSquare size={16} />
</a>
</li>
<li>
<li className="tooltip tooltip-bottom" data-tip="Ellipse">
<a onClick={() => switchCreate("ellipse")}>
<Diameter size={16} />
</a>
</li>
<li>
<li className="tooltip tooltip-bottom" data-tip="Line">
<a onClick={() => switchCreate("line")}>
<Spline size={16} />
</a>
</li>
<li>
<li className="tooltip tooltip-bottom" data-tip="Speech bubble">
<a onClick={() => switchCreate("speech")}>
<MessageSquare size={16} />
</a>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/features/authoring/topbar/ShapeSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,22 @@ function ShapeSection() {
<ChromePicker
value={props.fill}
onChange={(value) => modifyProps("fill", value)}
tooltip="Fill color"
>
<PaintBucket size={13} />
</ChromePicker>
<ChromePicker
value={props.stroke}
onChange={(value) => modifyProps("stroke", value)}
tooltip="Stroke color"
>
<Pencil size={13} />
</ChromePicker>
<MultiInput
value={props.strokeWidth}
values={widths}
onChange={(v) => modifyProps("strokeWidth", v)}
tooltip="Stroke width"
>
<RulerIcon size={16} />
</MultiInput>
Expand Down
19 changes: 13 additions & 6 deletions frontend/src/features/authoring/topbar/TextSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ function TextSection() {
/>

<div className="divider divider-horizontal" />

<NumberInput
value={Number(style.fontSize)}
onChange={(value) => modifyStyle("fontSize", value)}
/>

<div className="tooltip tooltip-bottom" data-tip="Font size">
<NumberInput
value={Number(style.fontSize)}
onChange={(value) => modifyStyle("fontSize", value)}
/>
</div>
<div className="divider divider-horizontal" />

<ToggleInput
value={style.fontWeight}
onToggle={(value) => modifyStyle("fontWeight", value)}
enabled="bold"
disabled="normal"
tooltip="Bold"
>
<Bold size={16} />
</ToggleInput>
Expand All @@ -79,6 +80,7 @@ function TextSection() {
onToggle={(value) => modifyStyle("fontStyle", value)}
enabled="italic"
disabled="normal"
tooltip="Italic"
>
<Italic size={16} />
</ToggleInput>
Expand All @@ -87,18 +89,21 @@ function TextSection() {
onToggle={(value) => modifyStyle("textDecoration", value)}
enabled="underline"
disabled="none"
tooltip="Underline"
>
<Underline size={16} />
</ToggleInput>
<ChromePicker
value={style.textColor}
onChange={(value) => modifyStyle("textColor", value)}
tooltip="Text color"
>
<span>A</span>
</ChromePicker>
<ChromePicker
value={style.highlightColor}
onChange={(value) => modifyStyle("highlightColor", value)}
tooltip="Highlight color"
>
<Highlighter size={14} />
</ChromePicker>
Expand All @@ -114,6 +119,7 @@ function TextSection() {
<AlignRight size={16} />,
]}
onChange={(value) => modifyStyle("alignment", value)}
tooltip="Alignment"
>
<AlignLeft size={16} />
</MultiInput>
Expand All @@ -122,6 +128,7 @@ function TextSection() {
value={style.lineHeight}
values={[1, 1.1, 1.25, 1.5, 1.75, 2]}
onChange={(value) => modifyStyle("lineHeight", value)}
tooltip="Line height"
>
<ArrowDownNarrowWide size={16} />
</MultiInput>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/features/authoring/topbar/Topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ function Topbar({ saving, save }: { saving: boolean; save: () => void }) {

<div className="divider divider-horizontal" />

<li>
<li className="tooltip tooltip-bottom" data-tip="Undo">
<a onClick={undo}>
<Undo2Icon size={16} />
</a>
</li>
<li>
<li className="tooltip tooltip-bottom" data-tip="Redo">
<a onClick={redo}>
<Redo2Icon size={16} />
</a>
Expand All @@ -59,7 +59,7 @@ function Topbar({ saving, save }: { saving: boolean; save: () => void }) {

{/* element creation */}
<ImageCreateMenu />
<li>
<li className="tooltip tooltip-bottom" data-tip="Add text">
<a onClick={() => switchCreate("textbox")}>
<Type size={16} />
</a>
Expand All @@ -72,12 +72,12 @@ function Topbar({ saving, save }: { saving: boolean; save: () => void }) {
<div className="divider divider-horizontal" />

{/* reorder */}
<li>
<li className="tooltip tooltip-bottom" data-tip="Bring to front">
<a onClick={() => bringToFront(selected)}>
<BringToFront size={16} />
</a>
</li>
<li>
<li className="tooltip tooltip-bottom" data-tip="Send to back">
<a onClick={() => sendToBack(selected)}>
<SendToBack size={16} />
</a>
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/features/authoring/wrapper/ChromePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ function ChromePicker({
children,
value,
onChange,
tooltip,
}: React.PropsWithChildren<{
value: string;
onChange: (value: string) => void;
tooltip?: string;
}>) {
const [open, setOpen] = useState(false);
const ref = useRef<HTMLDivElement | null>(null);
Expand All @@ -25,7 +27,10 @@ function ChromePicker({

return (
<div style={{ position: "relative", display: "flex" }}>
<li>
<li
className={tooltip ? "tooltip tooltip-bottom" : undefined}
data-tip={tooltip}
>
<a
className={`${open && "bg-base-100"}`}
onClick={() => setOpen(!open)}
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/features/authoring/wrapper/MultiInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type MultiInputProps = React.PropsWithChildren<{
values: MultiInputProps["value"][];
items?: ReactElement[];
onChange: (value: MultiInputProps["value"]) => void;
tooltip?: string;
}>;

function MultiInput({
Expand All @@ -13,10 +14,14 @@ function MultiInput({
items,
onChange,
children,
tooltip,
}: MultiInputProps) {
return (
<div className="dropdown">
<li>
<li
className={tooltip ? "tooltip tooltip-bottom" : undefined}
data-tip={tooltip}
>
<a tabIndex={0}>{children}</a>
</li>
<ul
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/features/authoring/wrapper/ToggleInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type ToggleInputProps = React.PropsWithChildren<{
onToggle: (value: string) => void;
enabled: string;
disabled: string;
tooltip?: string;
}>;

function ToggleInput({
Expand All @@ -11,6 +12,7 @@ function ToggleInput({
onToggle,
enabled,
disabled,
tooltip,
}: ToggleInputProps) {
const active = value === enabled;

Expand All @@ -20,7 +22,10 @@ function ToggleInput({
}

return (
<li>
<li
className={tooltip ? "tooltip tooltip-bottom" : undefined}
data-tip={tooltip}
>
<a className={`${active && "bg-base-100"}`} onClick={handleClick}>
{children}
</a>
Expand Down
Loading