Refactor the rqbit-web file by breaking it down into components and helper functions. Improve code organization and maintainability
This commit is contained in:
parent
a5e7a5a5f5
commit
f978ad02fe
25 changed files with 1722 additions and 926 deletions
23
crates/librqbit/webui/src/components/IconButton.tsx
Normal file
23
crates/librqbit/webui/src/components/IconButton.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { MouseEventHandler } from "react";
|
||||
|
||||
export const IconButton: React.FC<{
|
||||
className: string;
|
||||
onClick: () => void;
|
||||
disabled?: boolean;
|
||||
color?: string;
|
||||
}> = ({ className, onClick, disabled, color }) => {
|
||||
const onClickStopPropagation: MouseEventHandler<HTMLAnchorElement> = (e) => {
|
||||
e.stopPropagation();
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
onClick();
|
||||
};
|
||||
return (
|
||||
<a
|
||||
className={`bi ${className} p-1`}
|
||||
onClick={onClickStopPropagation}
|
||||
href="#"
|
||||
></a>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue