mirror of https://github.com/sunface/rust-course
parent
5c65dd3ab3
commit
271f852c01
@ -1,6 +1,7 @@
|
|||||||
import { requestApi } from "./axios/request"
|
import { requestApi } from "../src/utils/axios/request"
|
||||||
|
|
||||||
export let config = {
|
export let config = {
|
||||||
|
appName: "im.dev",
|
||||||
commonMaxlen: 255,
|
commonMaxlen: 255,
|
||||||
posts: {
|
posts: {
|
||||||
titleMaxLen: 128,
|
titleMaxLen: 128,
|
@ -0,0 +1,7 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
const DefaultTagCover = "https://cdn.hashnode.com/res/hashnode/image/upload/v1605308227907/y6yl3YLT4.png?w=1600&h=320&fit=crop&crop=entropy&auto=compress&auto=compress"
|
||||||
|
|
||||||
|
//users
|
||||||
|
const DefaultAvatar = "https://cdn.hashnode.com/res/hashnode/image/upload/v1600792675173/rY-APy9Fc.png?auto=compress"
|
||||||
|
const DefaultCover = "https://cdn.hashnode.com/res/hashnode/image/upload/v1604243390177/JstCbDgbK.jpeg?w=1600&fit=crop&crop=entropy&auto=compress"
|
@ -1,34 +0,0 @@
|
|||||||
import React from "react"
|
|
||||||
import {chakra, Heading, Image, Text, HStack,Button, Flex,PropsOf,Link} from "@chakra-ui/react"
|
|
||||||
import { Tag } from "src/types/tag"
|
|
||||||
import { ReserveUrls } from "src/data/reserve-urls"
|
|
||||||
import NextLink from "next/link"
|
|
||||||
|
|
||||||
type Props = PropsOf<typeof chakra.div> & {
|
|
||||||
tag: Tag
|
|
||||||
showActions: boolean
|
|
||||||
onEdit?: any
|
|
||||||
onDelete?: any
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const TagCard= (props:Props) =>{
|
|
||||||
const {tag,showActions,onEdit,onDelete, ...rest} = props
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Flex justifyContent="space-between" {...rest}>
|
|
||||||
<NextLink href={`${ReserveUrls.Tags}/${tag.name}`}>
|
|
||||||
<Heading size="sm" display="flex" alignItems="center" cursor="pointer">
|
|
||||||
<Image src={tag.icon} width="43px" mr="2"/>
|
|
||||||
{tag.title}
|
|
||||||
</Heading>
|
|
||||||
</NextLink>
|
|
||||||
{props.showActions && <HStack>
|
|
||||||
<Button size="sm" colorScheme="teal" variant="outline" onClick={onEdit}>Edit</Button>
|
|
||||||
<Button size="sm" onClick={props.onDelete} variant="ghost">Delete</Button>
|
|
||||||
</HStack>}
|
|
||||||
</Flex>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TagCard
|
|
@ -0,0 +1,40 @@
|
|||||||
|
import React from "react"
|
||||||
|
import {chakra, Heading, Image, Text, HStack,Button, Flex,PropsOf, Box, Tooltip, Tag as ChakraTag, useColorModeValue} from "@chakra-ui/react"
|
||||||
|
import { Tag } from "src/types/tag"
|
||||||
|
import { ReserveUrls } from "src/data/reserve-urls"
|
||||||
|
import NextLink from "next/link"
|
||||||
|
import userCustomTheme from "theme/user-custom"
|
||||||
|
|
||||||
|
type Props = PropsOf<typeof chakra.div> & {
|
||||||
|
tag: Tag
|
||||||
|
showActions?: boolean
|
||||||
|
onEdit?: any
|
||||||
|
onDelete?: any
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const TagCard= (props:Props) =>{
|
||||||
|
const {tag,showActions=false,onEdit,onDelete} = props
|
||||||
|
return (
|
||||||
|
<Flex justifyContent="space-between" alignItems="center" className="hover-bg" p="2">
|
||||||
|
<NextLink href={`${ReserveUrls.Tags}/${tag.name}`}>
|
||||||
|
<HStack cursor="pointer">
|
||||||
|
<Image src={tag.icon} width="43px" mr="2" borderWidth="1px" className="bordered"/>
|
||||||
|
<Box>
|
||||||
|
<Heading size="sm">{tag.title}</Heading>
|
||||||
|
<Tooltip openDelay={300} label={tag.md}><Text layerStyle="textSecondary" fontSize=".85rem" mt="1" overflow="hidden" textOverflow="ellipsis" whiteSpace="nowrap" width={{"sm": "100px","md":"400px","xl":"600px"}}>{tag.md}</Text></Tooltip>
|
||||||
|
</Box>
|
||||||
|
</HStack>
|
||||||
|
</NextLink>
|
||||||
|
{showActions ?
|
||||||
|
<HStack>
|
||||||
|
<Button size="sm" colorScheme="teal" variant="outline" onClick={onEdit}>Edit</Button>
|
||||||
|
<Button size="sm" onClick={onDelete} variant="ghost">Delete</Button>
|
||||||
|
</HStack> :
|
||||||
|
<ChakraTag py="1" px="3" colorScheme="cyan">{tag.postCount} posts</ChakraTag>
|
||||||
|
}
|
||||||
|
</Flex>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TagCard
|
Loading…
Reference in new issue