EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
4.04k stars 1.02k forks source link

A new theme and UI kit for EasyAdmin #4011

Closed javiereguiluz closed 3 years ago

javiereguiluz commented 3 years ago

During the past months I've been working a lot on several backends made with EasyAdmin. Some were simple whereas others were highly customizable:

I was thinking about ways to improve things ... and I think our biggest problem is our current template. In previous versions we used AdminLTE ... which we abandoned for EA3 because it looked dated and abandoned. Then we created a custom template based on Stripe, the most beautiful backend that I know of. The next step would be to create an "UI kit" based on that, to have a series of design components to design custom things. However:

So, instead of doing that, I started looking for "UI kits" that are open source and beautiful templates. There aren't many, but I found one that I liked a lot: Tabler

A few months ago it looked "abandoned", but it's regaining a lot of development activity and it's fully based on Bootstrap (they are aiming at the still unreleased Bootstrap 5). So, I think it's the perfect candidate to solve our problem.

I've started the migration of EasyAdmin to Tabler. It's far from finished, but it's progressing nicely. In addition to visual/design changes, I'm also making UX/UI improvements too. For example, in #4010 we were asked about adding a better paginator. Well, this is how the new paginator looks in my EasyAdmin+Tabler proof of concept:

image

Apart from this, having a "UI kit" like Tabler will allow us to create lots of design components so you can design your own backend actions/pages. My idea is to create Twig functions like this:

ea_theme_*(...arguments)

For example:

ea_theme_page_title(string $content, array $attr = [])
ea_theme_paginator(EntityPaginator $paginator, array $attr = [])
ea_theme_table(array $headers, array $rows, array $attr = [])
ea_theme_metric(string $value, string $label, string $subLabel = '', string $help = '', string $icon = '', array $attr = [])

And you can use those in your template like this:

{# attr is a list of HTML attributes applied to the parent HTML element of the component #}
{{ ea_theme_page_title('List of users of XXX', ['class' => 'text-large']) }}

Some of these functions will have lots and lots of arguments because the components are complex and very configurable. But, I don't think this is a problem thanks to Twig named params:

ea_theme_metric(value = num_users, label = 'New users', icon = 'fas fa-user')

The HTML of all these components would be defined as blocks in a single Twig template and the Twig function would render the appropriate block only. Like a Symfony form them but custom made.

So, what do you think of this proposal?

recchia commented 3 years ago

Hi, I'd like something made in tailwindcss, but if the requirement is bootstrap tabler seems ok

javiereguiluz commented 3 years ago

@recchia yes, I also prefer Tailwind CSS. The problem is that there are no open source "UI kits" for Tailwind CSS. There's https://tailwindui.com/ but it's proprietary.

In any case, Bootstrap 5 will include lots of utility classes like Tailwind CSS and I'm planning to add others for some things that I'll show later. Thanks!

freepius commented 3 years ago

Hi,

It's not easy for me to evaluate this big change, because I don't use EA enough to see all the blocking cases that you had (about creating custom actions/pages). I stayed in the EA classic using cases. In my little experience, I was able to change enough the things (overriding templates, overwriting twig blocks, writing custom css, using the customization functions of EA...)

I see that it will be not easy to upgrade my previous projects to this new UI kit... It's my only (big) negative point. :-1:

But Taber looks very nice. And I personalty prefer a lot bootstrap than Tailwind CSS (much to verbose for me, I prefer to write css instead). :+1:

I'm curious to see how the ea_theme_* twig functions could be used (because right now it's not obvious for me).

Finally I think more reusability and a nice ui kit are never bad :-) :+1:

So let's go! (if you need some help for that, be welcome)

NB: And other question is: how many time do you think a such migration can take for you? Because I suppose that the others EA developments must continue too.

creiner commented 3 years ago

I am a little ambivalent... on the one side tabler looks very good and appealing and easyadmin would definitly benefit from the change. But on the other side I think there are some features I would give more priority to (for example PR #3543 ).

The macro way looks good and very helpfull, but sometimes I find using the twig embed (https://twig.symfony.com/doc/2.x/tags/embed.html) possibility more clearer and better to read (when using complex content).

Edit: one more thing: I would propose that this would be a change for a 4.x version.

parijke commented 3 years ago

I like the idea, altough the clean interface (bit boring now) suits me well. I noticed one thing though. Instead of creating special theme functions, can't we use the natvice twig symtax like: {% include 'template.html' with {'foo': 'bar'} %} to pass vars to ui components? That is how atomic design systems like PatternLab are doing it as well? It prevent making another dependency?

I am not a specialist in any way, so maybe I am wrong on this

Also, I am expecting something like Laravel Livewie in the near future. Your closer to the source than I am, but if these rumours are true, maybe wait a little bit?

skianter commented 3 years ago

Hope this is not a blasphemy... but have you ever considered react too?

mahono commented 3 years ago

I also think this is something for 4.0 together with Symfony UX and updated layout template(s).

At this time I think it's more important to focus on adding missing features like batch actions, file upload and improvements of association/embedded and even documentation of the various fields.

Schyzophrenic commented 3 years ago

Whilst I think it's great for the future, I'd be keen to have a more stable v3 with features such as Batches, File uploads and translations added as well as an enhanced documentation.

tarjei commented 3 years ago

One thing that I find mildly problematic about doing this in the 3.x branch is that it changes styling of admins that are in production. A good upgrade path is important if you choose to go this route.

cmmata commented 3 years ago

I like the idea! Didn't know Tabler, looks like an interesting option. I personally liked the change to EasyAdmin 3 because of the conversion to PHP files instead of yaml, but I disliked the UI. I think losing the responsive UI was a step backward, so I think this would be a very nice improvement.

aleksblendwerk commented 3 years ago

At this time I think it's more important to focus on adding missing features like batch actions, file upload and improvements of association/embedded and even documentation of the various fields.

I thought the same when reading this issue but was hesitant to write anything because I don't want to rain on anyone's parade... I can understand it's always tempting to revamp the layout - but I think EasyAdmin looks really nice as it is and not dated at all. At my day job, we recently presented a nearly uncustomized default-look EasyAdmin backend to a customer and they were completely amazed that they got a pleasant admin backend along with their website.

I would like to see comfortable and nice-looking ways of adding related entities - this has been demanded since 2.x, proposed for 3.x but never ended up in the final product. I really wish this would be added this time around. I think the team and community should concentrate on features that make EasyAdmin more powerful and easier to extend for now.

The other issue proposing more usage of Symfony UX seems enough for me to add some more spice and convenience to the UX for now.

parijke commented 3 years ago

I tend to agree on this, focus on functionality over looks...

glavrjk commented 3 years ago

Have you seen the AdminLTE 3 template? It has improved a lot. With bootstrap 4 and light touches of material design and Dark Mode. I tried to implement it with EasyAdmin but nothing I could do.

ColorlibHQ - AdminLTE 3.1.0 Release Candidate

allan-simon commented 3 years ago

I agree with the others that the theme is not a problem, the fact that it looks like stripe is really a big help in internal discussion where you can shut bikeshedding but just using a fallacious authority argument "but hey it's what stripe does for their customer, so let's not deviate too far from that"

outside of this, for tailwind I've seen this theme https://www.creative-tim.com/learning-lab/tailwind-starter-kit/dashboard that is opensource , and could be splitted into 'components'

allan-simon commented 3 years ago

https://github.com/creativetimofficial/tailwind-starter-kit , the biggest advantage I see is that it does not customize tailwind , so the maintenance should be quite low (most of it will be leveraging the effort from tailwind's community )

MagePsycho commented 3 years ago

What if we can abstract the EasyAdmin functionality to have a themeable approach? +1 for TailWindCss + AlpineJs based theme

parijke commented 3 years ago

Nice idea...

allan-simon commented 3 years ago

What if we can abstract the EasyAdmin functionality to have a themeable approach?

you can already define your own theme to replace the default one no ?

MagePsycho commented 3 years ago

What if we can abstract the EasyAdmin functionality to have a themeable approach?

you can already define your own theme to replace the default one no ?

How can we do that BTW?

allan-simon commented 3 years ago

https://github.com/EasyCorp/EasyAdminBundle/blob/4ab197d18327e231c79974c772fc05defe3e85a8/doc/crud.rst#templates-and-form-options

it let you provide your own template path

allan-simon commented 3 years ago

https://github.com/EasyCorp/EasyAdminBundle/blob/4ab197d18327e231c79974c772fc05defe3e85a8/doc/crud.rst#template-names-and-template-paths

javiereguiluz commented 3 years ago

Thanks everybody for your comments! I see that we cannot do this until EasyAdmin 4.0, so I'm closing this for now to not discuss about this anymore. I'll come back about this in the future with a pull request.