mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 07:26:46 +00:00
build React.
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import BLOG from '@/blog.config'
|
||||
import Link from 'next/link'
|
||||
import NotionIcon from './NotionIcon'
|
||||
import { useRouter } from 'next/router'
|
||||
import React from 'react'
|
||||
|
||||
const BlogPostCard = ({ post, className }) => {
|
||||
const router = useRouter()
|
||||
const currentSelected = router.asPath.split('?')[0] === '/' + post.slug
|
||||
const pageIcon = post.pageIcon.indexOf("amazonaws.com")!=-1 ? post.pageIcon+"&width=88" : post.pageIcon
|
||||
const pageIcon = post.pageIcon.indexOf('amazonaws.com') !== -1 ? post.pageIcon + '&width=88' : post.pageIcon
|
||||
return (
|
||||
<Link href={`${removeHttp(post.slug)}`} target={(checkRemoveHttp(post.slug) ? '_blank' : '_self')} passHref>
|
||||
<div key={post.id} className={`${className} h-full rounded-lg p-4 dark:bg-neutral-800 cursor-pointer bg-white hover:bg-white rounded-2xl dark:hover:bg-gray-800 ${currentSelected ? 'bg-green-50 text-green-500' : ''}`}>
|
||||
@@ -23,9 +21,9 @@ const BlogPostCard = ({ post, className }) => {
|
||||
)
|
||||
function removeHttp(str) {
|
||||
// 检查字符串是否包含http
|
||||
if (str.includes("http")) {
|
||||
if (str.includes('http')) {
|
||||
// 如果包含,找到http的位置
|
||||
let index = str.indexOf("http");
|
||||
const index = str.indexOf('http');
|
||||
// 返回http之后的部分
|
||||
return str.slice(index, str.length);
|
||||
} else {
|
||||
@@ -35,11 +33,9 @@ const BlogPostCard = ({ post, className }) => {
|
||||
}
|
||||
function checkRemoveHttp(str) {
|
||||
// 检查字符串是否包含http
|
||||
if (str.includes("http")) {
|
||||
if (str.includes('http')) {
|
||||
// 如果包含,找到http的位置
|
||||
let index = str.indexOf("http");
|
||||
// 包含
|
||||
return true;
|
||||
return str.indexOf('http') > -1
|
||||
} else {
|
||||
// 不包含
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import BlogPostCard from './BlogPostCard'
|
||||
import React, { useState } from 'react'
|
||||
import NotionIcon from './NotionIcon'
|
||||
// import Collapse from '@/components/Collapse'
|
||||
|
||||
/**
|
||||
@@ -11,16 +9,11 @@ import NotionIcon from './NotionIcon'
|
||||
* @constructor
|
||||
*/
|
||||
const BlogPostItem = (props) => {
|
||||
const { group, filterLinks } = props
|
||||
// const [isOpen, changeIsOpen] = useState(group?.selected)
|
||||
|
||||
// const toggleOpenSubMenu = () => {
|
||||
// changeIsOpen(!isOpen)
|
||||
// }
|
||||
const { group } = props
|
||||
|
||||
console.log('####### group')
|
||||
console.log(group)
|
||||
|
||||
|
||||
if (group?.category) {
|
||||
return <>
|
||||
<div id={group?.category} className='category text-lg font-normal pt-9 pb-4 first:pt-4 select-none flex justify-between font-sans text-neutral-800 dark:text-neutral-400 p-2' key={group?.category}>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useNavGlobal } from '@/themes/nav'
|
||||
import React from 'react'
|
||||
import JumpToTopButton from './JumpToTopButton'
|
||||
|
||||
export default function BottomMenuBar({ post, className }) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react'
|
||||
import CategoryItem from './CategoryItem'
|
||||
|
||||
const CategoryGroup = ({ currentCategory, categoryOptions }) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useImperativeHandle } from 'react'
|
||||
import { useEffect, useImperativeHandle, useRef } from 'react'
|
||||
|
||||
/**
|
||||
* 折叠面板组件,支持水平折叠、垂直折叠
|
||||
@@ -7,7 +7,7 @@ import React, { useEffect, useImperativeHandle } from 'react'
|
||||
*/
|
||||
const Collapse = props => {
|
||||
const { collapseRef } = props
|
||||
const ref = React.useRef(null)
|
||||
const ref = useRef(null)
|
||||
const type = props.type || 'vertical'
|
||||
|
||||
useImperativeHandle(collapseRef, () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
|
||||
export default function LeftMenuBar () {
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import BlogPostCard from './BlogPostCard'
|
||||
import React, { useState } from 'react'
|
||||
import { useState } from 'react'
|
||||
import Collapse from '@/components/Collapse'
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user