@equinor/eds-core-react
Version:
The React implementation of the Equinor Design System
38 lines (35 loc) • 1.18 kB
JavaScript
import { forwardRef } from 'react';
import styled from 'styled-components';
import { primary } from './Card.tokens.js';
import { jsxs, jsx } from 'react/jsx-runtime';
import { Typography } from '../Typography/Typography.js';
const {
spacings
} = primary;
const StyledCardActions = styled.div.withConfig({
displayName: "CardActions__StyledCardActions",
componentId: "sc-1d5vskp-0"
})(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;justify-content:", ";padding:0 ", " 0 ", ";margin-top:auto;&:first-child{padding-top:", ";}&:last-child{padding-bottom:", ";}"], ({
$justifyContent
}) => $justifyContent, spacings.right, spacings.left, spacings.top, spacings.bottom);
const CardActions = /*#__PURE__*/forwardRef(function CardActions({
children,
alignRight = false,
meta = '',
...rest
}, ref) {
const $justifyContent = alignRight ? 'flex-end' : 'flex-start';
const props = {
ref,
$justifyContent,
...rest
};
return /*#__PURE__*/jsxs(StyledCardActions, {
...props,
children: [children, meta !== '' && /*#__PURE__*/jsx(Typography, {
variant: "caption",
children: meta
})]
});
});
export { CardActions };