backend/assistants_web: Fix alignment of wikipedia toggle #870
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the alignment of the Wikipedia switch, in the feature to toggle tools on or off.
I have fixed the issue by setting a width in the top level div of the Switch component. The reason why this fixes the issue is because a
flex-grow
class is being used in the container div around the description and switch divs. The switch has a width of 30px defined in it already, but not at the top level div returned by the component, but rather on theHUSwitch
component it uses. The width on theHUSwitch
component made the switch itself look the right size, but theSwitch
component was growing also, not just the description, since it didn't have an explicit width.The reason why this only affected the other tools (Python Interpreter & Hybrid Web Search), and not Wikipedia, is because of the shorter description for Wikipedia. With the longer descriptions, the
flex-grow: 1
made the description div the one that grew all the way, because of the overflowing text. But with the short description that didn't reach the end of the line, theflex-grow: 1
made both the div around the switch, and the div around the description both grow. With the explicit width at the top level div of theSwitch
component, but not width on the div around the description, the div around the description is the one that always grows.I tried a couple of other ways of dealing with this, such as right aligning the switch, but I didn't like that the container div around it was still a different size. I tried adding a
basis-0
class, but the effect was that the buttons were all properly aligned, but not at the very end. I think just setting the width where I have is fine, and it should not affect anywhere else in the code where the switch is used, because an explicitw-[30px]
class is already hard-coded into theSwitch
component.AI Description
This PR updates the
Switch
component in thesrc/interfaces/assistants_web/src/components/UI/Switch.tsx
file.Changes
w-10
class is replaced withw-[30px]
to adjust the width of thediv
element.