1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/common/HeaderTitle/HeaderTitle.jsx
Fredrik Strand Oseberg 92f3f8af08 Feat/environment crud (#335)
* feat: add env

* fix: create environment form

* feat: create environment

* feat: add deletion protection

* fix: lift up state

* feat: add ability to update environment

* fix: remove env reset

* fix: remove link

* feat: add drag and drop sorting

* fix: remove unused imports

* feat: add methods to toggle env on/off

* feat: only make api call on drop

* fix: disabled text

* fix: add disabled indicator

* fix: add edit env payload

* fix: add E flag

* fix: cleanup

* fix: update snapshots

* fix: remove useFeature

* fix: change property to errorText

* fix: update tests

* fix: change menu

* fix: update snapshots

* feat: toggle view v2

* fix: handle error on sort order api call

* fix: remove unused import

* fix: useFeature

* fix: update tests

* fix: console logs

* fix: use try catch

* fix: update snapshots
2021-09-14 14:20:23 +02:00

50 lines
1.3 KiB
JavaScript

import React from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';
import { Typography } from '@material-ui/core';
import ConditionallyRender from '../ConditionallyRender/ConditionallyRender';
import { useStyles } from './styles';
const HeaderTitle = ({
title,
actions,
subtitle,
variant,
loading,
className = '',
}) => {
const styles = useStyles();
const headerClasses = classnames({ skeleton: loading });
return (
<div className={styles.headerTitleContainer}>
<div className={headerClasses} data-loading>
<Typography
variant={variant || 'h2'}
className={classnames(styles.headerTitle, className)}
>
{title}
</Typography>
{subtitle && <small>{subtitle}</small>}
</div>
<ConditionallyRender
condition={actions}
show={<div className={styles.headerActions}>{actions}</div>}
/>
</div>
);
};
export default HeaderTitle;
HeaderTitle.propTypes = {
title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
subtitle: PropTypes.string,
variant: PropTypes.string,
loading: PropTypes.bool,
actions: PropTypes.element,
};