62 lines
1.5 KiB
Handlebars
Raw Normal View History

2021-07-21 20:08:17 +02:00
{{#if styled}}
import styled from 'styled-components'
{{else}}
/**
*
2022-07-29 13:45:20 +02:00
* {{ name }}
2021-07-21 20:08:17 +02:00
*
*/
// import PropTypes from 'prop-types';
import React from 'react';
{{#if useI18n}}
import { useIntl } from 'react-intl';
{{#unless plugin "===" "admin"}}
import { getTrad } from '../../utils';
{{/unless}}
2021-07-21 20:08:17 +02:00
{{/if}}
{{#if useRedux}}
import { useDispatch, useSelector } from 'react-redux';
2022-07-29 13:45:20 +02:00
import { select{{ name }}Domain } from './selectors';
2021-07-21 20:08:17 +02:00
import { defaultAction } from './actions';
{{/if}}
{{/if}}
{{#if styled}}
2022-07-29 13:45:20 +02:00
const {{ name }} = styled.{{ htmlTag }}``;
2021-07-21 20:08:17 +02:00
{{else}}
2022-07-29 13:45:20 +02:00
const {{ name }} = () => {
2021-07-21 20:08:17 +02:00
{{#if useI18n}}
const { formatMessage } = useIntl();
{{/if}}
{{#if useRedux}}
const dispatch = useDispatch();
// eslint-disable-next-line no-unused-vars
2022-07-29 13:45:20 +02:00
const state = useSelector(select{{ name }}Domain);
2021-07-21 20:08:17 +02:00
const handleClick = () => dispatch(defaultAction())
{{/if}}
2021-07-22 14:10:54 +02:00
{{#if useI18n "||" useRedux}}
2021-07-21 20:08:17 +02:00
2021-07-22 14:10:54 +02:00
{{/if}}
2021-07-21 20:08:17 +02:00
return (
<div>
{{#if useRedux}}
2021-07-22 14:10:54 +02:00
<button type="button" onClick={handleClick}>{{titleCase name}}</button>
2021-07-21 20:08:17 +02:00
{{/if}}
{{#if useI18n}}
<p>{formatMessage({ id: {{#if plugin "===" "admin"~}}
'component.name'
{{~else~}}
getTrad('component.name')
{{~/if}}, defaultMessage: '{{titleCase name}}' })}</p>
2021-07-21 20:08:17 +02:00
{{/if}}
</div>
);
};
2022-07-29 13:45:20 +02:00
{{ name }}.propTypes = {};
2021-07-21 20:08:17 +02:00
{{/if}}
2022-07-29 13:45:20 +02:00
export default {{ name }};