diff --git a/packages/client/src/components/template/card/index.tsx b/packages/client/src/components/template/card/index.tsx index 86b365e..d5fe8bd 100644 --- a/packages/client/src/components/template/card/index.tsx +++ b/packages/client/src/components/template/card/index.tsx @@ -21,6 +21,17 @@ export interface IProps { onClosePreview?: () => void; } +const bodyStyle = { + overflow: 'auto', +}; +const titleContainerStyle = { + marginBottom: 12, + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + overflow: 'hidden', +} as React.CSSProperties; +const flexStyle = { display: 'flex' }; + export const TemplateCard: React.FC = ({ template, onClick, @@ -35,26 +46,35 @@ export const TemplateCard: React.FC = ({ Router.push(`/template/${template.id}/`); }, [template]); + const cancel = useCallback(() => { + toggleVisible(false); + onClosePreview && onClosePreview(); + }, [toggleVisible, onClosePreview]); + + const preview = useCallback(() => { + toggleVisible(true); + onOpenPreview && onOpenPreview(); + }, [toggleVisible, onOpenPreview]); + + const useTemplate = useCallback(() => { + onClick && onClick(template.id); + }, [onClick, template.id]); + return ( <> { - toggleVisible(false); - onClosePreview && onClosePreview(); - }} + onCancel={cancel} footer={null} fullScreen > -
+
@@ -68,14 +88,7 @@ export const TemplateCard: React.FC = ({
-
+
{template.title}
@@ -92,28 +105,16 @@ export const TemplateCard: React.FC = ({
-
+
已使用 {template.usageAmount}次
- - {onClick && ( - - )}