Skip to content
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

feat: allow tables to be scrolled horizontally with ease in Admin #919

Merged
merged 2 commits into from Apr 28, 2024

Conversation

hgaol
Copy link
Contributor

@hgaol hgaol commented Apr 23, 2024

fix #917 , I just blindly set the min-width of post column to 15rem, pls let me know if any comment. ++@shuashuai to help to review. Thanks!

image

@shuashuai
Copy link
Member

Thanks for the contribution!

There are several pages here that need to be adjusted at the same time:

  1. ui/src/pages/Admin/Answers/index.tsx
  2. ui/src/pages/Admin/Qustions/index.tsx
  3. ui/src/pages/Timeline/index.tsx

I just blindly set the min-width of post column to 15rem

Other cells also need to set a minimum width. The width only needs to match the title content of the cell, the main content can be appropriately widened. This can be achieved through inline styles or adding classes.

If you have any other questions, you can continue the discussion and I will do my best to help you.

@hgaol
Copy link
Contributor Author

hgaol commented Apr 24, 2024

Thanks @shuashuai ! Sry I'm not quite good at CSS. I found that when I shrink the width of the page, or just set a very small width of the table or table cell, it doesn't take effect. And the width of the column looks like is what you want, matching the title content of the cell. e.g.
image

Do you know why and should I continue to set the min-width to adjust the other title content? And how...

Back to the main content, do you mean the 'Post' column? What about 20rem, or any other suggested value? Thanks a lot!

@shuashuai
Copy link
Member

@hgaol

Back to the main content, do you mean the 'Post' column? What about 20rem, or any other suggested value?

yes, I think 15rem is more suitable!

Note that in the /admin/answers page, the post width will also be determined by div.text-truncate-2, you can see here
image

you need to modify the size through media query:

  1. first add an index.scss file, then reference the file within the page `import './index.scss';
  2. add the following code
    image
  3. div.text-truncate-2 add class 'max-w-30' and remove inline style
    image

Do you know why and should I continue to set the min-width to adjust the other title content? And how...

What I mean is to try to avoid title being compressed. this can be achieved simply,you can avoid this by adding the class name text-nowrap, eg:

image

The final effect looks like this:

image

@hgaol
Copy link
Contributor Author

hgaol commented Apr 25, 2024

updated, could you help to review, thx! @shuashuai

Copy link
Member

@shuashuai shuashuai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@shuashuai shuashuai merged commit 9792e1f into apache:dev Apr 28, 2024
@hgaol hgaol deleted the 917 branch April 30, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants