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

Introduce flex-list & flex-item elements for Gitea UI #25790

Merged
merged 22 commits into from
Jul 31, 2023

Conversation

denyskon
Copy link
Member

@denyskon denyskon commented Jul 9, 2023

This PR introduces a new UI element type for Gitea called flex-item. It consists of a horizontal card with a leading, main and trailing part:

grafik

The idea behind it is that in Gitea UI, we have many cases where we use this kind of layout, but it is achieved in many different ways:

  • grid layout
  • .ui.list with additional hacky flexbox
  • .ui.key.list - looks to me like a style set originally created for ssh/gpg key list, was used in many other places
  • .issue.list - created for issue cards, used in many other places
  • ...

This new style is based on .issue.list, specifically the refactoring of it done in #25750.

In this PR, the new element is introduced and lots of templates are being refactored to use that style. This allows to remove a lot of page-specific css, makes many of the elements responsive or simply provides a cleaner/better-looking way to present information.

A devtest section with the new style is also available.

Screenshots (left: before, right: after)

Bildschirmfoto vom 2023-07-09 21-01-21
Bildschirmfoto vom 2023-07-09 21-01-56
Bildschirmfoto vom 2023-07-09 21-02-45
Bildschirmfoto vom 2023-07-09 21-03-44
Bildschirmfoto vom 2023-07-09 21-04-52
Bildschirmfoto vom 2023-07-09 21-05-25
Bildschirmfoto vom 2023-07-09 21-06-35
Bildschirmfoto vom 2023-07-09 21-09-03
Bildschirmfoto vom 2023-07-09 21-09-44
Bildschirmfoto vom 2023-07-09 21-10-27
Bildschirmfoto vom 2023-07-09 21-11-12
Bildschirmfoto vom 2023-07-09 21-12-01
Bildschirmfoto vom 2023-07-09 21-17-44
Bildschirmfoto vom 2023-07-09 21-18-27
Bildschirmfoto vom 2023-07-09 21-19-18
Bildschirmfoto vom 2023-07-09 21-29-13
Bildschirmfoto vom 2023-07-09 21-30-11
Bildschirmfoto vom 2023-07-09 21-32-44
Bildschirmfoto vom 2023-07-09 21-33-28

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 9, 2023
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 9, 2023
@denyskon denyskon added type/enhancement An improvement of existing functionality topic/ui Change the appearance of the Gitea UI type/refactoring Existing code has been cleaned up. There should be no new functionality. labels Jul 9, 2023
@denyskon denyskon added this to the 1.21.0 milestone Jul 9, 2023
@KN4CK3R
Copy link
Member

KN4CK3R commented Jul 9, 2023

Is there a way to reduce the space above "yesterday" at the bottom?
https://user-images.githubusercontent.com/47871822/252165284-c1b7c22e-3e5a-46d4-b8d6-5560db478c0b.png

@denyskon
Copy link
Member Author

denyskon commented Jul 9, 2023

Done :)
grafik

@wxiaoguang
Copy link
Contributor

IIRC there is already a flex-items-block ?

@denyskon denyskon changed the title Introduce flex-card & flex-list elements for Gitea UI Introduce flex-list & flex-item elements for Gitea UI Jul 10, 2023
@silverwind
Copy link
Member

Missed this one, will review soon.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 31, 2023
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

Haven't gotten time for testing it.

Some selectors are likely having unnecessary dependency, eg: .flex-list .branches .truncated-name and flex-list .branches .branch. Ideally, the "flex-list.css" is a independent layout framework, the "page" related selectors may need a totally new selector, eg: .xxx-branch-list .branch ....

But I can vote my LGTM, while I think some improvements could be done later.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 31, 2023
@puni9869 puni9869 added reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Jul 31, 2023
@GiteaBot GiteaBot added the lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. label Jul 31, 2023
@puni9869 puni9869 removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jul 31, 2023
@denyskon
Copy link
Member Author

@wxiaoguang Thanks for noticing, I moved the unrelated styles to the issue-list css file where they belong.

@denyskon
Copy link
Member Author

I would like to wait for silverwind's opinion before merging, as this is a large refactoring.

@silverwind
Copy link
Member

Looks good and I can't really spot any difference between the old issuelist, so let's give this a try.

@silverwind silverwind merged commit b9baed2 into go-gitea:main Jul 31, 2023
23 checks passed
@denyskon denyskon deleted the refactor/flex-card branch July 31, 2023 22:20
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 1, 2023
* upstream/main:
  Introduce `flex-list` & `flex-item` elements for Gitea UI (go-gitea#25790)
  Mention `devtest` in frontend contributing guidelines (go-gitea#26249)
silverwind pushed a commit that referenced this pull request Aug 8, 2023
Regression of #25790
Fixes #26310

---------

Co-authored-by: Giteabot <teabot@gitea.io>
wxiaoguang added a commit that referenced this pull request Aug 23, 2023
Follow #26649 and #25790 and add one more example (text truncate) in the devtest page
<div role="main" aria-label="{{.Title}}" class="page-content organization members">
<div role="main" aria-label="{{.Title}}" class="page-content organization">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why to delete this "members" class?

Copy link
Member

Choose a reason for hiding this comment

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

Is there any impact? of regression

Copy link
Member

@silverwind silverwind Oct 26, 2023

Choose a reason for hiding this comment

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

Maybe they were depending on this class for customization. I wonder if there would be a better way to indicate the current page to CSS, like an data attribute that indicates the matching template file or router. We could make better stability guarantees for those then these flimsy classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any impact? of regression

Although there is currently no impact. But there is no way to tell under Vanilla JS whether it is a "Members" page.

Copy link
Member

@silverwind silverwind Oct 30, 2023

Choose a reason for hiding this comment

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

In JS, you could check the URL which I guess is more stable than these classes. e.g. check if /^\/[^/]+/[^/]+/members$/.test(window.location.pathname).

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants