UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

56 lines (53 loc) 1.83 kB
import _extends from "@babel/runtime/helpers/extends"; /** * @jsxRuntime classic * @jsx jsx */ import React from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic import { css, jsx } from '@emotion/react'; import { injectIntl } from 'react-intl'; // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss import { Box, Text, xcss } from '@atlaskit/primitives'; import { messages } from './messages'; const captionWrapperStyle = css({ marginTop: "var(--ds-space-100, 8px)", textAlign: 'center', position: 'relative', color: "var(--ds-text-subtle, #505258)" }); const placeholderStyle = xcss({ color: 'color.text.subtlest', position: 'absolute', top: 'space.0', width: '100%' }); // Ignored via go/ees005 // eslint-disable-next-line @repo/internal/react/no-class-components export class CaptionComponent extends React.Component { render() { const { selected, hasContent, children, dataAttributes, intl: { formatMessage } } = this.props; const showPlaceholder = !selected && !hasContent; return jsx("div", _extends({ "data-media-caption": true, "data-testid": "media-caption" // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading }, dataAttributes, { css: captionWrapperStyle }), showPlaceholder ? jsx(Box, { xcss: placeholderStyle }, jsx(Text, null, formatMessage(messages.placeholder))) : null, children); } } // eslint-disable-next-line @typescript-eslint/ban-types const _default_1 = injectIntl(CaptionComponent); export default _default_1;