mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 02:35:42 +00:00
fix: restore styling for local characters list (#152)
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import { WdCheckbox, WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit';
|
||||
|
||||
/**
|
||||
* Display modes for the responsive checkbox.
|
||||
*
|
||||
* - "full": show the full label (e.g. "Show offline" or "Show ship name")
|
||||
* - "abbr": show the abbreviated label (e.g. "Offline" or "Ship name")
|
||||
* - "checkbox": show only the checkbox (no text)
|
||||
* - "hide": do not render the checkbox at all
|
||||
*/
|
||||
export type WdDisplayMode = "full" | "abbr" | "checkbox" | "hide";
|
||||
|
||||
|
||||
export interface WdResponsiveCheckboxProps {
|
||||
tooltipContent: string;
|
||||
size: 'xs' | 'normal' | 'm';
|
||||
labelFull: string;
|
||||
labelAbbreviated: string;
|
||||
value: boolean;
|
||||
onChange: () => void;
|
||||
classNameLabel?: string;
|
||||
containerClassName?: string;
|
||||
labelSide?: 'left' | 'right';
|
||||
displayMode: WdDisplayMode;
|
||||
}
|
||||
|
||||
export const WdResponsiveCheckbox: React.FC<WdResponsiveCheckboxProps> = ({
|
||||
tooltipContent,
|
||||
size,
|
||||
labelFull,
|
||||
labelAbbreviated,
|
||||
value,
|
||||
onChange,
|
||||
classNameLabel,
|
||||
containerClassName,
|
||||
labelSide = 'left',
|
||||
displayMode,
|
||||
}) => {
|
||||
if (displayMode === "hide") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const label =
|
||||
displayMode === "full"
|
||||
? labelFull
|
||||
: displayMode === "abbr"
|
||||
? labelAbbreviated
|
||||
: displayMode === "checkbox"
|
||||
? ""
|
||||
: labelFull;
|
||||
|
||||
const checkbox = (
|
||||
<div className={clsx("min-w-0", containerClassName)}>
|
||||
<WdCheckbox
|
||||
size={size}
|
||||
labelSide={labelSide}
|
||||
label={label}
|
||||
value={value}
|
||||
classNameLabel={classNameLabel}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
return tooltipContent ? (
|
||||
<WdTooltipWrapper content={tooltipContent}>{checkbox}</WdTooltipWrapper>
|
||||
) : (
|
||||
checkbox
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export * from './WdResponsiveCheckbox';
|
||||
Reference in New Issue
Block a user