Skip to content

Commit 06d001d

Browse files
authored
Merge pull request #2230 from tf/content-element-full-box
Allow setting different border radius for full width elements
2 parents 867b2de + ee2b918 commit 06d001d

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

entry_types/scrolled/doc/creating_themes/custom_colors_and_dimensions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ elements etc.
172172
| Name | Description |
173173
| ---- | ----------- |
174174
| `content_element_box_border_radius` | Display content element boxes with rounded corners. |
175+
| `content_element_full_box_border_radius` | Set to control rounded corners of elements with full width. Defaults to `content_element_box_border_radius`. |
175176

176177
### Text Block Styles
177178

entry_types/scrolled/package/src/frontend/ContentElementBox.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
2+
import classNames from 'classnames';
23

34
import {useContentElementAttributes} from './useContentElementAttributes';
5+
import {widths} from './layouts/widths';
46

57
import styles from './ContentElementBox.module.css';
68

@@ -12,14 +14,14 @@ import styles from './ContentElementBox.module.css';
1214
* @param {string} props.children - Content of box.
1315
*/
1416
export function ContentElementBox({children}) {
15-
const {position} = useContentElementAttributes();
17+
const {position, width} = useContentElementAttributes();
1618

1719
if (position === 'backdrop') {
1820
return children;
1921
}
2022

2123
return (
22-
<div className={styles.wrapper}>
24+
<div className={classNames(styles.wrapper, {[styles.full]: width === widths.full})}>
2325
{children}
2426
</div>
2527
);

entry_types/scrolled/package/src/frontend/ContentElementBox.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
overflow: hidden;
33
border-radius: var(--theme-content-element-box-border-radius);
44
}
5+
6+
.full {
7+
border-radius: var(--theme-content-element-full-box-border-radius,
8+
var(--theme-content-element-box-border-radius));
9+
}

entry_types/scrolled/package/src/frontend/__stories__/appearance-stories.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,24 @@ storiesOf(`Frontend/Section Appearance`, module)
181181
);
182182
}
183183
)
184+
.add(
185+
'Custom Border Radiuses expect full width',
186+
() => {
187+
const customBorderRadiusStyles = {
188+
'--theme-cards-border-radius': '0',
189+
'--theme-content-element-box-border-radius': '10px',
190+
'--theme-content-element-full-box-border-radius': '0'
191+
};
192+
193+
return (
194+
<RootProviders seed={exampleSeed('cards')}>
195+
<div style={customBorderRadiusStyles}>
196+
<Entry />
197+
</div>
198+
</RootProviders>
199+
);
200+
}
201+
)
184202

185203
storiesOf(`Frontend/Section Appearance`, module)
186204
.add(

0 commit comments

Comments
 (0)