feat: 添加事件描述组件
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
// src/views/Community/components/DynamicNewsDetail/EventDescriptionSection.js
|
||||||
|
// 事件描述区组件
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Heading,
|
||||||
|
Text,
|
||||||
|
useColorModeValue,
|
||||||
|
} from '@chakra-ui/react';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件描述区组件
|
||||||
|
* @param {Object} props
|
||||||
|
* @param {string} props.description - 事件描述文本
|
||||||
|
*/
|
||||||
|
const EventDescriptionSection = ({ description }) => {
|
||||||
|
const sectionBg = useColorModeValue('gray.50', 'gray.750');
|
||||||
|
const headingColor = useColorModeValue('gray.700', 'gray.200');
|
||||||
|
const textColor = useColorModeValue('gray.600', 'gray.400');
|
||||||
|
|
||||||
|
// 如果没有描述,不渲染
|
||||||
|
if (!description) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box bg={sectionBg} p={3} borderRadius="md">
|
||||||
|
{/* 事件描述 */}
|
||||||
|
<Box>
|
||||||
|
<Heading size="sm" color={headingColor} mb={2}>
|
||||||
|
事件描述
|
||||||
|
</Heading>
|
||||||
|
<Text fontSize="sm" color={textColor} lineHeight="tall">
|
||||||
|
{description}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EventDescriptionSection;
|
||||||
Reference in New Issue
Block a user