1+ import { css } from '@emotion/react' ;
12import React from 'react' ;
23import { Card , CardBody , CardFooter , CardHeader , CardProps , Content , ContentVariants , Flex , FlexItem } from '@patternfly/react-core' ;
3- import { HelperText } from '@patternfly/react-core/dist/dynamic/components/HelperText' ;
4- import { HelperTextItem } from '@patternfly/react-core/dist/dynamic/components/HelperText' ;
5- import { createUseStyles } from 'react-jss' ;
4+ import { HelperText , HelperTextItem } from '@patternfly/react-core/dist/dynamic/components/HelperText' ;
65import clsx from 'clsx' ;
76
87/** extends CardProps */
@@ -27,15 +26,15 @@ export interface ServiceCardProps extends CardProps {
2726 isFullHeight ?: boolean ;
2827}
2928
30- const useStyles = createUseStyles ( {
31- fullHeightCard : {
32- height : ' 100%'
33- } ,
34- image : {
35- marginRight : ' var(--pf-t--global--spacer--md)' ,
36- width : 48
37- }
38- } ) ;
29+ const styles = {
30+ fullHeightCard : css `
31+ height : 100% ;
32+ ` ,
33+ image : css `
34+ margin-right : var (--pf-t--global--spacer--md );
35+ width : 48 px ;
36+ `
37+ } ;
3938
4039const ServiceCard : React . FunctionComponent < ServiceCardProps > = ( {
4140 title,
@@ -48,38 +47,34 @@ const ServiceCard: React.FunctionComponent<ServiceCardProps> = ({
4847 isStacked = false ,
4948 isFullHeight = false ,
5049 ...props
51- } : ServiceCardProps ) => {
52- const classes = useStyles ( ) ;
53-
54- return (
55- < Card className = { clsx ( { [ classes . fullHeightCard ] : isFullHeight } ) } ouiaId = { `${ ouiaId } -card` } { ...props } >
56- < CardHeader >
57- < Flex direction = { { default : isStacked ? 'column' : 'row' } } alignItems = { { default : isStacked ? 'alignItemsFlexStart' : 'alignItemsCenter' } } >
58- < FlexItem className = { classes . image } >
59- { icon }
60- </ FlexItem >
61- < FlexItem >
62- < Content >
63- < Content component = { ContentVariants . h2 } ouiaId = { `${ ouiaId } -title` } > { title } </ Content >
64- { subtitle ?? null }
65- </ Content >
66- </ FlexItem >
67- </ Flex >
68- </ CardHeader >
69- < CardBody data-ouia-component-id = { `${ ouiaId } -description` } > { description } </ CardBody >
70- { footer || helperText ? (
71- < CardFooter data-ouia-component-id = { `${ ouiaId } -footer` } >
72- { helperText ?
73- ( < HelperText data-ouia-component-id = { `${ ouiaId } -helper-text` } >
74- < HelperTextItem className = "pf-v6-u-mb-lg" >
75- { helperText }
76- </ HelperTextItem >
77- </ HelperText > ) : null
78- }
79- { footer }
80- </ CardFooter > ) : null }
81- </ Card >
82- )
83- }
50+ } : ServiceCardProps ) => (
51+ < Card className = { clsx ( { [ styles . fullHeightCard . toString ( ) ] : isFullHeight } ) } ouiaId = { `${ ouiaId } -card` } { ...props } >
52+ < CardHeader >
53+ < Flex direction = { { default : isStacked ? 'column' : 'row' } } alignItems = { { default : isStacked ? 'alignItemsFlexStart' : 'alignItemsCenter' } } >
54+ < FlexItem css = { styles . image } >
55+ { icon }
56+ </ FlexItem >
57+ < FlexItem >
58+ < Content >
59+ < Content component = { ContentVariants . h2 } ouiaId = { `${ ouiaId } -title` } > { title } </ Content >
60+ { subtitle ?? null }
61+ </ Content >
62+ </ FlexItem >
63+ </ Flex >
64+ </ CardHeader >
65+ < CardBody data-ouia-component-id = { `${ ouiaId } -description` } > { description } </ CardBody >
66+ { footer || helperText ? (
67+ < CardFooter data-ouia-component-id = { `${ ouiaId } -footer` } >
68+ { helperText ?
69+ ( < HelperText data-ouia-component-id = { `${ ouiaId } -helper-text` } >
70+ < HelperTextItem className = "pf-v6-u-mb-lg" >
71+ { helperText }
72+ </ HelperTextItem >
73+ </ HelperText > ) : null
74+ }
75+ { footer }
76+ </ CardFooter > ) : null }
77+ </ Card >
78+ ) ;
8479
8580export default ServiceCard ;
0 commit comments