All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.components.BasicInformation.js Maven / Gradle / Ivy

There is a newer version: 2.0.101
Show newest version
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayIcon from '@clayui/icon';
import ClayLayout from '@clayui/layout';
import ClaySticker from '@clayui/sticker';
import classnames from 'classnames';
import {sub} from 'frontend-js-web';
import PropTypes from 'prop-types';
import React, {useContext} from 'react';

import {StoreStateContext} from '../context/StoreContext';
import Translation from './Translation';

function Author({author: {authorId, name, url}}) {
	return (
		
{url ? ( {`${name}.`} ) : ( )} {sub(Liferay.Language.get('authored-by-x'), name)}
); } function BasicInformation({ author, canonicalURL, onSelectedLanguageClick, publishDate, title, viewURLs, }) { const {languageTag} = useContext(StoreStateContext); const formattedPublishDate = Intl.DateTimeFormat(languageTag, { day: 'numeric', month: 'long', year: 'numeric', }).format(new Date(publishDate)); return (
{title} {canonicalURL}
{sub( Liferay.Language.get('published-on-x'), formattedPublishDate )} {author && ( )}
); } Author.propTypes = { author: PropTypes.object.isRequired, }; BasicInformation.propTypes = { author: PropTypes.object, canonicalURL: PropTypes.string.isRequired, onSelectedLanguageClick: PropTypes.func.isRequired, publishDate: PropTypes.string.isRequired, title: PropTypes.string.isRequired, viewURLs: PropTypes.arrayOf( PropTypes.shape({ default: PropTypes.bool.isRequired, languageId: PropTypes.string.isRequired, selected: PropTypes.bool.isRequired, viewURL: PropTypes.string.isRequired, }) ).isRequired, }; export default BasicInformation;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy