From 02e9c108d10173a592db265425685fcde66723c9 Mon Sep 17 00:00:00 2001 From: Chang Wei Date: Wed, 30 Nov 2022 17:59:37 +0800 Subject: [PATCH] update @pingcap-inc/tidb-community-ui: fix SidebarEvent --- .../asktug/home/Sidebar/SidebarEvent.less | 68 ++++++++++++++++++- .../asktug/home/Sidebar/SidebarEvent.tsx | 46 ++++++++++--- 2 files changed, 103 insertions(+), 11 deletions(-) diff --git a/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.less b/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.less index dccfa2d0..dfef3e5d 100644 --- a/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.less +++ b/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.less @@ -1,7 +1,73 @@ .asktug { &-sidebar { - &-blog { + &-event { + &-container { + display: flex; + cursor: pointer; + padding: 1rem 0; + border-bottom: 1px solid #e9eaee; + &:hover { + border-color: #be1d32; + svg { + visibility: visible; + } + } + &-head { + font-size: 14px; + color: #ffffff; + background: #b6b9c3; + } + &-body { + display: flex; + justify-content: center; + height: 25px; + font-size: 18px; + font-weight: bold; + color: #2d3758; + background: #ffffff; + position: relative; + &-arrow { + position: absolute; + bottom: -2px; + right: -1px; + color: #b6b9c3; + transform: rotate(-45deg); + z-index: 2; + width: 13px; + height: 13px; + &-oppsite { + color: #f7f8f9; + transform: rotate(135deg); + bottom: -5px; + right: -5px; + z-index: 1; + } + } + } + } + &-content { + flex: 1; + + h3 { + font-size: 16px; + font-weight: normal; + margin-bottom: 0; + } + + .ant-badge { + margin-left: 2rem; + + &-status-text { + font-size: 12px; + color: rgba(#2c2c2c, 0.6); + } + + &:first-child { + margin-left: 0; + } + } + } ul { list-style: none; a { diff --git a/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.tsx b/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.tsx index 90ce2a40..ab1512aa 100644 --- a/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.tsx +++ b/packages/site-components/src/components/asktug/home/Sidebar/SidebarEvent.tsx @@ -1,10 +1,13 @@ import React, {useEffect, useState} from "react" import axios from "axios"; +import dayjs from "dayjs"; +import {Badge} from "antd"; import './SidebarEvent.less' import SidebarCard from "./SidebarCard"; import SiteLink from "../../../site-link"; import {Site} from "../../../../utils/site"; +import {CaretUpOutlined} from "@ant-design/icons"; export interface IProps extends React.HTMLAttributes { } @@ -23,9 +26,10 @@ export interface IEvent { } const getEvents = async () => { - const url = 'http://localhost:3300/api/cms/tidbio-homepage-main-activities' - const response = await axios.get(url) - return response.data + //const url = 'http://localhost:3300/next-api/cms/tidbio-homepage-main-activities' + //const response = await axios.get(url) + //return response.data + return [] } const SidebarEvent: React.FC = (props) => { @@ -35,17 +39,39 @@ const SidebarEvent: React.FC = (props) => { useEffect(() => { getEvents().then(setEvents) }, []) + return (
更多 {'>'})}}>
    - {events.map((value) => ( -
  • - - - -
  • - ))} + {events.map((value) => { + const dayObj = dayjs(value.date); + const month = dayObj.format('MMM'); + const day = dayObj.format('D'); + return ( +
  • + +
    +
    +
    {month}
    +
    + {day} + + +
    +
    +
    +

    {value.title}

    +
    + {/*{value.status && }*/} + {value.type && } +
    +
    +
    +
    +
  • + ) + })}