sunmao-sdk
Version:
榫卯-开箱即用赋能-sdk
39 lines (36 loc) • 930 B
JavaScript
import React from "react";
import { Tag, Tooltip } from "antd";
import { getDateTime, getDate } from "./utils";
const PrompText = ({ text = "", prompText }) => (
<Tooltip title={prompText || text}>
<span>{text}</span>
</Tooltip>
);
export default {
tags: tags => (
<div>
{tags.map(tag => {
return (
<Tag color="volcano" key={tag}>
{tag.toUpperCase()}
</Tag>
);
})}
</div>
),
dateTime: value => getDateTime(value),
date: value => getDate(value),
tooltip: text => <PrompText text={text} />,
status: value => {
switch (value.status) {
case "Default":
return <Tag color="blue">{value.text}</Tag>;
case "Error":
return <Tag color="red">{value.text}</Tag>;
case "Success":
return <Tag color="green">{value.text}</Tag>;
default:
return <Tag color="blue">{value.text}</Tag>;
}
}
};