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

[@mantine/core] Spoiler: removed extra margin bottom when "Show more" is hidden #4928

Merged
merged 6 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@
version "0.0.0"
uid ""

"@mantine/store@7.0.2":
version "7.0.2"
resolved "https://registry.yarnpkg.com/@mantine/store/-/store-7.0.2.tgz#cb3288829c75c5d6b96555cab33c58c72cc32c3d"
integrity sha512-0OAca3r/IQ6c7Pb6YvmL+5hyCo31vA3SfZKTwb1KquX4SjFfjpdhPuTR/tzjmxqwIw4zkzXH/7ckNZ/AHHwm8A==
"@mantine/store@7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@mantine/store/-/store-7.1.0.tgz#81e64631e71dfb5098a5d3d9831c70f15cb23bc5"
integrity sha512-WmU1jxsHWex5gcoAoB6C/vyVbDiWp6k6iroXHRWIqzd7vQ9SiLzXNygLTlilwW4HwkkJZGUsskSbwzFo+oqiSw==

"@mantine/store@link:../src/mantine-store":
version "0.0.0"
Expand Down
4 changes: 3 additions & 1 deletion src/mantine-core/src/components/Spoiler/Spoiler.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.root {
position: relative;
margin-bottom: rem(24px);
&[data-has-spoiler] {
Jacouille marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: rem(24px);
Copy link
Member

Choose a reason for hiding this comment

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

Properties must not be set inside &[data-has-spoiler] – it will be impossible to override without !important. Use css variables in this case, see other components styles as reeference.

}
}

.content {
Expand Down
8 changes: 7 additions & 1 deletion src/mantine-core/src/components/Spoiler/Spoiler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ export const Spoiler = factory<SpoilerFactory>((_props, ref) => {
const spoilerMoreContent = show ? hideLabel : showLabel;

return (
<Box {...getStyles('root')} id={_id} ref={ref} {...others}>
<Box
{...getStyles('root')}
id={_id}
ref={ref}
data-has-spoiler={spoiler || undefined}
{...others}
>
{spoiler && (
<Anchor
component="button"
Expand Down
8 changes: 8 additions & 0 deletions src/mantine-styles-api/src/data/Spoiler.styles-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ export const SpoilerStylesApi: StylesApiData<SpoilerFactory> = {
'--spoiler-transition-duration': 'Controls transition duration',
},
},

modifiers: [
{
modifier: 'data-has-spoiler',
selector: 'root',
value: 'Whether the control button is shown or not',
Jacouille marked this conversation as resolved.
Show resolved Hide resolved
},
],
};
Loading