-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A11y: Make Annotations and Template Variables list and edit pages responsive #71791
A11y: Make Annotations and Template Variables list and edit pages responsive #71791
Conversation
const value = useMemo( | ||
() => REFRESH_OPTIONS.find((o) => o.value === refresh)?.value ?? REFRESH_OPTIONS[0].value, | ||
[refresh] | ||
); | ||
|
||
return ( | ||
<Field label="Refresh" description="When to update the values of this variable"> | ||
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} /> | ||
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} size={width < 375 ? 'sm' : 'md'} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good solution (not worth it, and just makes code messy, and not a pattern we use anywhere else )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how scrolling just the table is better than scrolling the page? is not scrolling the page a bit more discoverable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left small comments, but the changes look great. Thanks @juanicabanas to take care of this!
</Droppable> | ||
</DragDropContext> | ||
</table> | ||
<div style={{ overflow: 'scroll', width: '100%' }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use here emotion as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! I didn't catch it
@@ -14,14 +15,15 @@ const REFRESH_OPTIONS = [ | |||
]; | |||
|
|||
export function QueryVariableRefreshSelect({ onChange, refresh }: PropsWithChildren<Props>) { | |||
const { width } = useWindowSize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use useMediaQueryChange
hook? This will only trigger a re-render when the media query changes, not when the window size changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loved it. didn't know it
const value = useMemo( | ||
() => REFRESH_OPTIONS.find((o) => o.value === refresh)?.value ?? REFRESH_OPTIONS[0].value, | ||
[refresh] | ||
); | ||
|
||
return ( | ||
<Field label="Refresh" description="When to update the values of this variable"> | ||
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} /> | ||
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} size={width < 375 ? 'sm' : 'md'} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why don't we set a width and the labels are automatically truncated? I like this improvement anyways, although md
works for screens like iPhone SE already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried it and it seems it's not possible with the RadioButtonGroup we currently have. I should make some modifications to that core component
@torkelo I think it's better since otherwise, the whole page would look as broken |
@juanicabanas yea, your right. just feels like this just hides the problem but maybe with more rows in the table it's easier to notice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for applying the feedback, LGTM!
What is this feature?
It makes annotations, template variables and edit template variables configuration pages responsive.
Which issue(s) does this PR fix?:
Fixes #66487
Special notes for your reviewer:
Since there are tables inside these pages, it's not possible to avoid the horizontal scrolling behavior.
I fixed the responsive design.
Annotations config page
annotations_page.mov
Template variables config page
variables_page.mov
Template variables edit page
variables_edit_page.mov
Please check that: