Files
mediacms/frontend/src/static/js/components/_shared/circle-icon-button/CircleIconButton.jsx
Yiannis Stergiou aa6520daac Frontent dev env (#247)
* Added frontend development files/environment

* More items-categories related removals

* Improvements in pages templates (inc. static pages)

* Improvements in video player

* Added empty home page message + cta

* Updates in media, playlist and management pages

* Improvements in material icons font loading

* Replaced media & playlists links in frontend dev-env

* frontend package version update

* chnaged frontend dev url port

* static files update

* Changed default position of theme switcher

* enabled frontend docker container
2021-07-11 18:01:34 +03:00

63 lines
1.3 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import './CircleIconButton.scss';
export function CircleIconButton(props) {
const children = (
<span>
<span>{props.children}</span>
</span>
);
const attr = {
tabIndex: props.tabIndex || null,
title: props.title || null,
className:
'circle-icon-button' +
(void 0 !== props.className ? ' ' + props.className : '') +
(props.buttonShadow ? ' button-shadow' : ''),
};
if (void 0 !== props['data-page-id']) {
attr['data-page-id'] = props['data-page-id'];
}
if (void 0 !== props['aria-label']) {
attr['aria-label'] = props['aria-label'];
}
if ('link' === props.type) {
return (
<a {...attr} href={props.href || null} rel={props.rel || null}>
{children}
</a>
);
}
if ('span' === props.type) {
return (
<span {...attr} onClick={props.onClick || null}>
{children}
</span>
);
}
return (
<button {...attr} onClick={props.onClick || null}>
{children}
</button>
);
}
CircleIconButton.propTypes = {
type: PropTypes.oneOf(['button', 'link', 'span']),
buttonShadow: PropTypes.bool,
className: PropTypes.string,
};
CircleIconButton.defaultProps = {
type: 'button',
buttonShadow: false,
};