Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 221ecdb

Browse files
committed
Updated component props
1 parent b492caa commit 221ecdb

File tree

6 files changed

+38
-32
lines changed

6 files changed

+38
-32
lines changed

components/atoms/Separator/Separator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import styles from './Separator.module.css'
1010
* @param {object} props The component attributes as props.
1111
* @param {string} props.className Optional classname.
1212
* @param {boolean} props.fullWidth Is this a fullwidth block.
13-
* @return {Element} The Separator component.
13+
* @return {Element} The Separator component.
1414
*/
1515
export default function Separator(props) {
1616
const {className, fullWidth} = props

components/atoms/Spacer/Spacer.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import React from 'react'
33
import tailwindConfig from '../../../tailwind.config'
44

55
/**
6-
* @param props
6+
* Render the Spacer component.
7+
*
8+
* @author WebDevStudios
9+
* @param {object} props The component attributes as props.
10+
* @param {string} props.anchor Optional anchor/id.
11+
* @param {number} props.height The height of the spacer.
12+
* @return {Element} The Spacer component.
713
*/
814
export default function Spacer(props) {
9-
const {pxHeight, anchor} = props
15+
const {height, anchor} = props
1016

1117
const rootEmVal = parseFloat(tailwindConfig.theme.fontSize['root-em'])
1218

@@ -15,7 +21,7 @@ export default function Spacer(props) {
1521
id={anchor || null}
1622
style={{
1723
/* stylelint-disable-next-line value-keyword-case */
18-
height: `${pxHeight / rootEmVal}rem`
24+
height: `${height / rootEmVal}rem`
1925
}}
2026
aria-hidden="true"
2127
/>
@@ -24,9 +30,9 @@ export default function Spacer(props) {
2430

2531
Spacer.propTypes = {
2632
anchor: PropTypes.string,
27-
pxHeight: PropTypes.number.isRequired
33+
height: PropTypes.number.isRequired
2834
}
2935

3036
Spacer.defaultProps = {
31-
pxHeight: 40
37+
height: 40
3238
}

components/blocks/BlockHeadings/BlockHeadings.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ import React from 'react'
99
* The core Headings block from Gutenberg.
1010
*
1111
* @author WebDevStudios
12-
* @param props.props
13-
* @param {object} props The component attributes as props.
14-
* @param {string} props.className Optional classnames.
15-
* @param {string} props.align Optional alignment style.
16-
* @param {string} props.anchor Optional anchor/id.
17-
* @param {string} props.content The content of the block.
18-
* @param {string} props.level The heading level.
19-
* @return {Element} The RichText component.
12+
* @param {string} className Optional classnames.
13+
* @param {string} align Optional alignment style.
14+
* @param {string} anchor Optional anchor/id.
15+
* @param {string} content The content of the block.
16+
* @param {string} level The heading level.
17+
* @return {Element} The RichText component.
2018
*/
21-
export default function BlockHeadings({props}) {
22-
const {className, align, anchor, content, level} = props
19+
export default function BlockHeadings({
20+
className,
21+
align,
22+
anchor,
23+
content,
24+
level
25+
}) {
2326
const alignment = !align ? 'left' : align
2427

2528
return (
@@ -34,7 +37,6 @@ export default function BlockHeadings({props}) {
3437
}
3538

3639
BlockHeadings.propTypes = {
37-
props: PropTypes.object.isRequired,
3840
anchor: PropTypes.string,
3941
align: PropTypes.string,
4042
className: PropTypes.string,

components/blocks/BlockParagraph/BlockParagraph.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ import PropTypes from 'prop-types'
1616
* @param {string} props.content The content of the block.
1717
* @return {Element} The RichText component.
1818
*/
19-
export default function BlockParagraph({props}) {
20-
const {className, align, anchor, content} = props
19+
export default function BlockParagraph({className, align, anchor, content}) {
2120
// TODO Add settings for unused props in default WP Paragraph Block
2221
const alignment = !align ? 'left' : align
2322
return (
@@ -32,7 +31,6 @@ export default function BlockParagraph({props}) {
3231
}
3332

3433
BlockParagraph.propTypes = {
35-
props: PropTypes.object.isRequired,
3634
align: PropTypes.string,
3735
anchor: PropTypes.string,
3836
className: PropTypes.string,

components/blocks/BlockSpacer/BlockSpacer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import PropTypes from 'prop-types'
1313
* @return {Element} The Spacer component.
1414
*/
1515
export default function BlockSpacer({anchor, height}) {
16-
return <Spacer pxHeight={height} id={anchor} />
16+
return <Spacer height={height} id={anchor} />
1717
}
1818

1919
BlockSpacer.propTypes = {
2020
anchor: PropTypes.string,
2121
height: PropTypes.number
2222
}
2323
BlockSpacer.defaultProps = {
24-
anchor: 50
24+
height: 40
2525
}

functions/displayBlock.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ export default function displayBlock(block, index) {
1515
// prettier-ignore
1616
switch (name) {
1717
case 'acf/accordions':
18-
return <Blocks.BlockAccordions props={attributes} key={index} />
18+
return <Blocks.BlockAccordions {...attributes} key={index} />
1919
case 'acf/netflix':
2020
return (
21-
<Blocks.BlockNetflixCarousel props={attributes} key={index} />
21+
<Blocks.BlockNetflixCarousel {...attributes} key={index} />
2222
)
2323
case 'core/block-quote':
24-
return <Blocks.BlockBlockquote props={attributes} key={index} />
24+
return <Blocks.BlockBlockquote {...attributes} key={index} />
2525
case 'core/embed':
26-
return <Blocks.BlockVideoEmbed props={attributes} key={index} />
26+
return <Blocks.BlockVideoEmbed {...attributes} key={index} />
2727
case 'core/heading':
28-
return <Blocks.BlockHeadings props={attributes} key={index} />
28+
return <Blocks.BlockHeadings {...attributes} key={index} />
2929
case 'core/image':
30-
return <Blocks.BlockImage props={attributes} key={index} />
30+
return <Blocks.BlockImage {...attributes} key={index} />
3131
case 'core/image-gallery':
32-
return <Blocks.BlockImageGallery props={attributes} key={index} />
32+
return <Blocks.BlockImageGallery {...attributes} key={index} />
3333
case 'core/list':
34-
return <Blocks.BlockList props={attributes} key={index} />
34+
return <Blocks.BlockList {...attributes} key={index} />
3535
case 'core/paragraph':
36-
return <Blocks.BlockParagraph props={attributes} key={index} />
36+
return <Blocks.BlockParagraph {...attributes} key={index} />
3737
case 'core/separator':
3838
return <Blocks.BlockSeparator {...attributes} key={index} />
3939
case 'core/shortcode':
40-
return <Blocks.BlockShortcode props={attributes} key={index} />
40+
return <Blocks.BlockShortcode {...attributes} key={index} />
4141
case 'core/spacer':
4242
return <Blocks.BlockSpacer {...attributes} key={index} />
4343
default:

0 commit comments

Comments
 (0)