File size: 1,215 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {
	__experimentalVStack as VStack,
	__experimentalHStack as HStack,
	__experimentalText as Text,
} from '@wordpress/components';
import { forwardRef } from 'react';
import type { ActionItemProps } from './types';
import './action-item.scss';

function UnforwardedActionItem(
	{ title, description, decoration, actions }: ActionItemProps,
	ref: React.ForwardedRef< HTMLSpanElement >
) {
	return (
		<VStack className="action-item" ref={ ref } as="span">
			<HStack spacing={ 3 } justify="flex-start" alignment="center" as="span">
				{ !! decoration && <span className="action-item__decoration">{ decoration }</span> }
				<HStack as="span">
					<VStack spacing={ 1 } as="span">
						<Text weight={ 500 } lineHeight="20px">
							{ title }
						</Text>
						{ description && (
							<Text variant="muted" lineHeight="20px">
								{ description }
							</Text>
						) }
					</VStack>
					<HStack
						className="action-item__actions"
						spacing={ 2 }
						justify="flex-end"
						expanded={ false }
						as="span"
					>
						{ actions }
					</HStack>
				</HStack>
			</HStack>
		</VStack>
	);
}

export const ActionItem = forwardRef( UnforwardedActionItem );

export default ActionItem;