Skip to content

Commit

Permalink
Merge branch 'release/1.2' of github.com:bigbite/build-tools into rel…
Browse files Browse the repository at this point in the history
…ease/1.2
  • Loading branch information
ampersarnie committed Mar 15, 2023
2 parents 28a0978 + 4770186 commit 39c260a
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 2 deletions.
1 change: 1 addition & 0 deletions configs/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = (projectConfig) => {
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/react-in-jsx-scope': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
Expand Down
87 changes: 87 additions & 0 deletions example-site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions example-site/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"name": "test-project"
}
"name": "test-project",
"dependencies": {
"prop-types": "^15.8.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import SVGAsComponent from '@Static/logo.svg';
import SVGAsURL from '@Static/svg-file.svg?url';
import MailIconPNG from '@Static/mail-icon.png';

import TestComponent from './TestComponent';

/**
* Display Component for an example block.
*/
Expand All @@ -12,6 +14,7 @@ export default () => (
<img src={SVGAsURL} alt="Reference and SVG as the url" />
</div>
<div>Example Block</div>
<TestComponent additionalValue="This is not hidden" />
<div>
<img src={MailIconPNG} alt="PNG Mail Icon for testing usage." />
</div>
Expand Down
24 changes: 24 additions & 0 deletions example-site/plugins/test-plugin/src/components/TestComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import PropTypes from 'prop-types';
import { __ } from '@wordpress/i18n';

/**
*
* @param {object} props Props for the component.
* @param {boolean} props.hiddenText Whether to hide the text.
* @param {string} props.additionalValue The value to output when text is not hidden.
* @returns
*/
const TestComponent = ({ hiddenText = false, additionalValue }) => {
if (hiddenText) {
return <div>{__('Hidden', 'bigbite-build-tools')}</div>;
}

return <div>{__(`My additional value is ${additionalValue}`, 'bigbite-build-tools')}</div>;
};

TestComponent.propTypes = {
hiddenText: PropTypes.bool,
additionalValue: PropTypes.string.isRequired,
};

export default TestComponent;

0 comments on commit 39c260a

Please sign in to comment.