Skip to content

Commit

Permalink
Adjust a button width
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Sep 15, 2024
1 parent d796b2a commit 44cff28
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/src/components/SolverOptions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export function OptionElem({ option, options, setOptions, fullWidth }) {

export default function SolverOptions({ options, setOptions, title }) {
const [navShow, setNavShow] = useState(false);
const [solverBtnWidth, setSolverBtnWidth] = useState(0);

const select_solver = <OverlayTrigger
placement="bottom"
Expand All @@ -174,7 +175,11 @@ export default function SolverOptions({ options, setOptions, title }) {
variant="outline-light"
onClick={() => setOptions(options.with_solver(!options.get_solver()))}
>
{options.get_solver() ? "Ty" : "BM"}
<CalculateWidth contents={"Ty"} setWidth={(w) => setSolverBtnWidth((old_w) => Math.max(old_w, w))} />
<CalculateWidth contents={"BM"} setWidth={(w) => setSolverBtnWidth((old_w) => Math.max(old_w, w))} />
<span style={{display: "inline-block", width: solverBtnWidth || null}}>
{options.get_solver() ? "Ty" : "BM"}
</span>
</Button>
</OverlayTrigger>;

Expand Down

0 comments on commit 44cff28

Please sign in to comment.