docbrown/app/javascript/article-form/components/PageTitle.jsx
Rajat Talesra 5966960c04
Create Preview Loading screen (#17914)
* Minor changes

* Basic implementation with some bugs

* Removed files

* Correct tab selection

* Added tests

* Disabled bottom bar buttons on preview loading

* Applied other changes

* Added tests for PageTitle

* Added tests for LoadingPreview

* Added test for Options.jsx

* Removed comments

* Fixed CSS

* Removed unused code

* Fixed test failure

* Added aria-live

* Nit fixe

* Fixed tests

* Applied suggested changes
2022-07-07 19:21:50 +05:30

40 lines
1.1 KiB
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
import { OrganizationPicker } from '../../organization/OrganizationPicker';
export const PageTitle = ({
organizations,
organizationId,
onToggle,
previewLoading,
}) => {
return (
<div className="crayons-field__label flex items-center flex-1">
<span className="hidden s:inline-block mr-2 whitespace-nowrap">
{previewLoading ? 'Loading preview' : 'Create Post'}
</span>
{organizations && organizations.length > 0 && (
<div>
<OrganizationPicker
name="article[organization_id]"
id="article_publish_under_org"
className="crayons-select mt-0"
organizations={organizations}
organizationId={organizationId}
onToggle={onToggle}
emptyLabel="Personal"
/>
</div>
)}
</div>
);
};
PageTitle.propTypes = {
organizations: PropTypes.arrayOf(PropTypes.string).isRequired,
organizationId: PropTypes.string,
onToggle: PropTypes.func.isRequired,
previewLoading: PropTypes.bool.isRequired,
};
PageTitle.displayName = 'Organization';