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

Add uncontained section design #11464

Open
wants to merge 9 commits into
base: 3.x
Choose a base branch
from

Conversation

divdax
Copy link

@divdax divdax commented Feb 17, 2024

Description

Extended Form Section with ->minimal() for a minimalistic style.

Section::make('Heading')->minimal()
default ->minimal()
image image

or maybe...

->compact(minimal: true)
->compact(basic: true)

This could be useful if someone wants to use a self-styled component (not just the section) without removing all styles:

->compact(styles: false)

What do you think?

Code style

  • composer cs command has been run.

Testing

  • Changes have been tested.

Documentation

  • Documentation is up-to-date.

@danharrin danharrin added enhancement New feature or request ui labels Feb 20, 2024
@danharrin danharrin added this to the v3 milestone Feb 20, 2024
@mischasigtermans

This comment was marked as off-topic.

@zepfietje zepfietje changed the title Section::minimal() Add minimal section design Feb 28, 2024
@zepfietje zepfietje changed the title Add minimal section design Add uncontained section design Feb 28, 2024
Copy link
Member

@zepfietje zepfietje left a comment

Choose a reason for hiding this comment

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

@divdax, could you rework this to contained(false), just like already exists for wizard, tabs and others?

@divdax
Copy link
Author

divdax commented Feb 28, 2024

@divdax, could you rework this to contained(false), just like already exists for wizard, tabs and others?

jo 👍

@divdax
Copy link
Author

divdax commented Feb 28, 2024

@zepfietje section is now using CanBeContained trait.

Comment on lines 9 to 10
:contained="$isContained()"
:compact="$isCompact()"
Copy link
Member

Choose a reason for hiding this comment

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

Please sort alphabetically :)

@@ -6,6 +6,7 @@
'aside' => false,
'collapsed' => false,
'collapsible' => false,
'contained' => true,
Copy link
Member

Choose a reason for hiding this comment

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

n comes after m ;)

Comment on lines 49 to 52
match ($aside) {
true => 'fi-aside grid grid-cols-1 items-start gap-x-6 gap-y-4 md:grid-cols-3',
false => 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10',
false => $contained ? 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10' : '',
},
Copy link
Member

Choose a reason for hiding this comment

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

Thinking about it once more, maybe it's easier to maintain if we got rid of the match expression and used two separate array items instead. One for the fi-aside with a condition as the value and then the other one for contained non-aside. Not sure if that explanation is clear? 😂

@@ -62,7 +63,7 @@
'cursor-pointer' => $collapsible,
match ($compact) {
true => 'px-4 py-2.5',
false => 'px-6 py-4',
false => ! $contained ? 'py-4' : 'px-6 py-4',
Copy link
Member

Choose a reason for hiding this comment

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

Could you split these into separate array items too?
Also, is the vertical padding needed when uncontained?

@@ -163,10 +164,10 @@
<div
@class([
'fi-section-content',
'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10' => $aside,
'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10' => $aside && (! $minimal),
Copy link
Member

@zepfietje zepfietje Mar 1, 2024

Choose a reason for hiding this comment

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

Looks like $minimal was forgotten during the refactor?

match ($compact) {
true => 'p-4',
false => 'p-6',
false => ! $contained ? 'pt-4' : 'p-6',
Copy link
Member

Choose a reason for hiding this comment

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

Also get rid of the match expression here, because this gets quite unreadable otherwise. 🙂

@saade
Copy link
Member

saade commented Mar 1, 2024

@zepfietje can we remove the border under the header too? or perhaps only apply if its collapsible.

@zepfietje
Copy link
Member

Still going to do a visual review after the code review, and the border is one thing for sure that I'm still debating.

Copy link
Member

@zepfietje zepfietje left a comment

Choose a reason for hiding this comment

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

@divdax, could you merge 3.x into this PR's branch and add support for the recently introduced section footer actions?

@divdax
Copy link
Author

divdax commented Mar 8, 2024

@zepfietje i did the refactor. looking into the footer actions this weekend (hopefully)

// edit: here an example why i used the border. Also looks better when using heading + description.
Do you know if there are any plans for unstyled elements using just the basic fi-* classes which i think are unstyled and just for reference? What i mean by that: Would be cool to give every element ->unstyled() to get rid of every css class so we could write custom css without having to override all filament classes. I hope you understand what i mean. 🙃

image

Heiko Klingele added 2 commits March 9, 2024 02:06
# Conflicts:
#	packages/forms/src/Components/Section.php
#	packages/support/resources/views/components/section/index.blade.php
@divdax
Copy link
Author

divdax commented Mar 9, 2024

@zepfietje merged 3.x and updated footer classes.

@ralphjsmit
Copy link
Contributor

Looking great, nice work Heiko! Been missing this for years.

@zepfietje
Copy link
Member

Could you guys provide some context on how you're using uncontained sections, @divdax @ralphjsmit? Would help me in reviewing the design in this PR.

@ralphjsmit
Copy link
Contributor

Some examples that I do remember are e.g. inside a modal on a white area where you don't want to have the card/another border for the content. Just a simple heading/description/icon to distinguish on a page would be good.
Or if you want to have the form components om the default gray Filament panel background (so not inside cards/sections), but that's impossible with the current Section design.

But mainly just serving as a visual indicator of splitting up the page without needing an indent/border/white background.

@divdax
Copy link
Author

divdax commented Mar 11, 2024

I often use sections in modals to save space and create a cleaner look. When a section is within another "container" i usually don't need a second box. Used filament forms standalone on many pages where i placed the form in an already styled container.

idea:
It would be great to deactivate all CSS classes with styles for components, leaving only the reference classes (e.g. .fi-section-content) without styles. This way, users can style from scratch instead of having to override existing styles.
Currently, you have to override all applied styles when writing a theme. Next step could be something like a global config e.g. Component::disableStyles().

@zepfietje
Copy link
Member

idea: It would be great to deactivate all CSS classes with styles for components, leaving only the reference classes (e.g. .fi-section-content) without styles. This way, users can style from scratch instead of having to override existing styles. Currently, you have to override all applied styles when writing a theme. Next step could be something like a global config e.g. Component::disableStyles().

This is already one of the main goals for v4. 👍

Copy link
Member

@zepfietje zepfietje left a comment

Choose a reason for hiding this comment

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

@divdax, I've done some more research about when to use uncontained sections and have come to the conclusion that it's best to remove the border below the header and above the footer too. Could you update the PR so I can do a proper final review? 🙂

@zepfietje
Copy link
Member

Hey @divdax, are you able to finish this PR?

@saade
Copy link
Member

saade commented Apr 4, 2024

@zepfietje i know this can be achieved with css for now, but i can take his work and apply the requested changes if you wish... i'm kinda needing that too to clean up some code at my end.

@zepfietje
Copy link
Member

Yeah, please go ahead @saade, since this PR has been stale for a while now.

@zepfietje zepfietje closed this Apr 4, 2024
@divdax
Copy link
Author

divdax commented Apr 8, 2024

@zepfietje i was on holidays. 🏖️ not sorry 😅

@zepfietje
Copy link
Member

No worries, @divdax!
We just have some default intervals at which we check in on the status of PRs to keep it all maintainable. 🙂

@saade
Copy link
Member

saade commented Apr 9, 2024

@divdax i didnt started yet, lmk if you want to continue with your work

@zepfietje
Copy link
Member

Yeah let us know, @divdax, then I can reopen your PR.

@divdax
Copy link
Author

divdax commented Apr 9, 2024

@zepfietje i'll take a look after work and make the final touches. i think it's just the heading border i have to remove.

// edit: Border removed when contained = false

@zepfietje zepfietje reopened this Apr 9, 2024
@zepfietje
Copy link
Member

Thanks, @divdax!
So this is ready for final review now?

@divdax
Copy link
Author

divdax commented Apr 10, 2024

@zepfietje yes

@divdax
Copy link
Author

divdax commented May 6, 2024

@zepfietje dumdidumm 👀😬

@zepfietje
Copy link
Member

@divdax, I've been extremely busy working towards the launch of Whizzy and have lost 25% of my GitHub Sponsors, so spending more time on Filament than I already do has been hard. I'll get back to reviewing this though! 😄

false => 'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10',
},
'fi-aside grid grid-cols-1 items-start gap-x-6 gap-y-4 md:grid-cols-3' => $aside,
'rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10' => $contained,
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem right?
The previously false match arm only has a $contained condition here.

@zepfietje
Copy link
Member

@divdax "dumdidumm". 😂
Could you have a look at my change request from two weeks ago? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants