Skip to content

Commit

Permalink
fix:antd css 局部引入,首页客户,贡献者模块
Browse files Browse the repository at this point in the history
  • Loading branch information
superlemonJump authored and FlechazoW committed Jul 18, 2022
1 parent 555618a commit 68268a9
Show file tree
Hide file tree
Showing 10 changed files with 626 additions and 8 deletions.
2 changes: 2 additions & 0 deletions website/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*
* See: https://www.gatsbyjs.com/docs/browser-apis/
*/
require("antd/lib/menu/style/index.css")
require("./src/styles/global.css")
require("./src/styles/normal.css")
const React = require("react")
// const { default: AppHeader } = require("./src/components/AppHeader")

Expand Down
18 changes: 18 additions & 0 deletions website/githubInfo/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @description 获取chunjun repo 成员的脚步
* 使用node 执行后 成员信息会保存在同级目录的 member.json下
*/
const axios = require('axios');
const contributorsApi = 'https://api.github.com/repos/DTStack/chunjun/contributors'
const fs = require('fs')
const path = require('path')
const fileName = 'members.json'
axios
.get(contributorsApi)
.then(res => {
fs.writeFileSync(path.resolve(__dirname, './' + fileName), JSON.stringify(res.data, null, '\t'))
})
.catch(error => {
console.error(error);
});

9 changes: 6 additions & 3 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"antd": "^4.21.5",
"aos": "^2.3.4",
"autoprefixer": "^10.4.7",
"axios": "^0.27.2",
"eslint-plugin-react": "^7.30.1",
"gatsby": "^4.17.2",
"gatsby-link": "^4.17.0",
Expand All @@ -39,6 +40,7 @@
"gatsby-transformer-sharp": "^4.17.0",
"gh-pages": "^4.0.0",
"highlight.js": "^11.5.1",
"lodash": "^4.17.21",
"node-sass": "^6.0.1",
"postcss": "^8.4.14",
"prop-types": "^15.8.1",
Expand All @@ -50,6 +52,7 @@
"react-json-tree": "^0.17.0",
"react-json-view": "^1.21.3",
"react-spring": "^9.4.5",
"react-transition-group": "^4.4.2",
"tailwindcss": "^3.1.0"
},
"devDependencies": {
Expand All @@ -65,11 +68,11 @@
],
"license": "0BSD",
"scripts": {
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"deploy": "node githubInfo/build && gatsby build --prefix-paths && gh-pages -d public",
"build": "gatsby build",
"develop": "gatsby develop ",
"develop": "node githubInfo/build && gatsby develop ",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,css}\"",
"start": "gatsby develop",
"start": "node githubInfo/build && gatsby develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
Expand Down
20 changes: 16 additions & 4 deletions website/src/components/AppContainer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,19 @@ const AppContainer = ({ children, data, category }) => {
if (c.type === "dir") {
return (
<Accordion key={c.name} iconPosition="right">
<Accordion.Item label={c.name}>{buildChildren(c.children)}</Accordion.Item>
<Accordion.Item label={c.name}>
{buildChildren(c.children)}
</Accordion.Item>
</Accordion>
)
} else {
return (
<Link activeClassName="active" key={c.data.id} to={`${category}/${c.data.id}`} className={` `}>
<Link
activeClassName="active"
key={c.data.id}
to={`${category}/${c.data.id}`}
className={` `}
>
{c.name}
</Link>
)
Expand All @@ -103,7 +110,10 @@ const AppContainer = ({ children, data, category }) => {
}
const { mode } = useContext(ModeContext)
return (
<div className="sticky top-[60px] w-[250px] overflow-x-hidden h-[calc(100vh-60px)]">
<div
id="root"
className="root sticky top-[60px] w-[250px] overflow-x-hidden h-[calc(100vh-60px)]"
>
<Menu
onClick={click}
style={{
Expand All @@ -129,7 +139,9 @@ const AppContainer = ({ children, data, category }) => {

<AppHeader />
<div className=" dark:bg-[#1a1b1e] dark:text-gray-300 relative border dark:border-black justify-between bg-white text-[ #ccc] flex z-20 shadow-lg">
{menuData.children && menuData.children.length > 0 && AsideMenu(menuData)}
{menuData.children &&
menuData.children.length > 0 &&
AsideMenu(menuData)}
{children}
</div>

Expand Down
18 changes: 18 additions & 0 deletions website/src/components/AppCustomers/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.item-enter {
opacity: 0;
transform: translateY(10px);
}
.item-enter-active {
opacity: 1;
transform: translateY(0);
transition: all 500ms ease-in;
}
.item-exit {
opacity: 1;
}
.item-exit-active {
opacity: 0;
transform: translateY(-60px);
transition: all 500ms ease-in;
}

175 changes: 175 additions & 0 deletions website/src/components/AppCustomers/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { chunk } from 'lodash'
import './index.css'
import React, { useLayoutEffect, useState } from 'react'
import { CSSTransition, TransitionGroup } from 'react-transition-group'
const AppCustomers = () => {
const imgs = [
{
img: require('../../assets/img/fudan.png').default,
id: 'fuda'
},
{
img: require('../../assets/img/API.png').default,
id: 'API'
},
{
img: require('../../assets/img/nat-4.png').default,
id: 'nat-4'
},
{
img: require('../../assets/img/nat-5.png').default,
id: 'nat-5'
},
{
img: require('../../assets/img/nat-6.png').default,
id: 'nat-6'
},
{
img: require('../../assets/img/nat-7.png').default,
id: 'nat-7'
},
{
img: require('../../assets/img/nat-8.png').default,
id: 'nat-8'
},
{
img: require('../../assets/img/nat-9.png').default,
id: 'nat-9'
},
{
img: require('../../assets/img/nat-10.png').default,
id: 'nat-10'
},
{
img: require('../../assets/img/pufa.png').default,
id: 'pufa'
},
{
img: require('../../assets/img/union.png').default,
id: 'union'
},
{
img: require('../../assets/img/zheda.png').default,
id: 'zheda'
},
{
img: require('../../assets/img/zhongxin.png').default,
id: 'zhongxin'
},
{
img: require('../../assets/img/nat-11.png').default,
id: 'nat-11'
},
{
img: require('../../assets/img/nat-12.png').default,
id: 'nat-12'
},
{
img: require('../../assets/img/nat-13.png').default,
id: 'nat-13'
},
{
img: require('../../assets/img/nat-14.png').default,
id: 'nat-14'
},
{
img: require('../../assets/img/nat-15.png').default,
id: 'nat-15'
},
{
img: require('../../assets/img/nat-16.png').default,
id: 'nat-16'
},
{
img: require('../../assets/img/nat-17.png').default,
id: 'nat-17'
},
{
img: require('../../assets/img/nat-18.png').default,
id: 'nat-18'
},
{
img: require('../../assets/img/nat-19.png').default,
id: 'nat-19'
},
{
img: require('../../assets/img/nat-20.png').default,
id: 'nat-20'
},
{
img: require('../../assets/img/nat-21.png').default,
id: 'nat-21'
},
{
img: require('../../assets/img/nat-22.png').default,
id: 'nat-22'
},
{
img: require('../../assets/img/nat-23.png').default,
id: 'nat-23'
},
{
img: require('../../assets/img/nat-24.png').default,
id: 'nat-24'
},
{
img: require('../../assets/img/nat-25.png').default,
id: 'nat-25'
},
{
img: require('../../assets/img/nat-26.png').default,
id: 'nat-26'
},
{
img: require('../../assets/img/nat-27.png').default,
id: 'nat-27'
},
{
img: require('../../assets/img/nat-28.png').default,
id: 'nat-28'
},
{
img: require('../../assets/img/nat-30.png').default,
id: 'nat-30'
}
]
const imagesList = chunk(imgs, 5)
const [activeList, setActive] = useState([...imagesList[0]])
useLayoutEffect(() => {
const timer = setInterval(() => {
imagesList.push(imagesList.shift())
setActive(origin => [])
setTimeout(() => {
setActive(origin => [...origin, ...imagesList[0]])
}, 500)
}, 1500)

return () => {
clearInterval(timer)
}
}, [])
return (
<section className="py-[50px] pb-[50px] w-[80%] m-auto">
<p className="mb-[20px] text-[27px]">
<span className="border-b-2 pb-[5px] text-[22px] font-bold text-gray-700 border-gray-300 inline-block">
合作伙伴
</span>
</p>
<div className="flex w-full overflow-hidden justify-start">
<TransitionGroup component={null}>
{activeList.map(item => {
return (
<CSSTransition key={item.id} timeout={500} classNames="item">
<div className="w-[20%] h-[90px] flex items-center justify-center">
<img className="max-w-[90%] max-h-full" src={item.img}></img>
</div>
</CSSTransition>
)
})}
</TransitionGroup>
</div>
</section>
)
}

export default AppCustomers
35 changes: 35 additions & 0 deletions website/src/components/AppGithubMember/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react'
import members from '../../../githubInfo/members.json'

const AppMembers = () => {
return (
<>
<section className="w-[80%] m-auto my-[50px]">
<p className="mb-[20px] text-[27px]">
<span className="border-b-2 pb-[5px] text-[22px] font-bold text-gray-700 border-gray-300 inline-block">
贡献者
</span>
</p>
<div className="flex flex-wrap m-[-7px]">
{members.map(item => {
return (
<div className="border border-gray-200 flex items-center justify-center m-[7px] hover:bg-slate-300 block">
<img
width={40}
height={40}
src={`https://github.com/${item.login}.png?size=40`}
alt=""
/>{' '}
<a href={item.html_url} target="blank">
<span className="p-[5px] text-gray-500"> {item.login} </span>
</a>
</div>
)
})}
</div>
</section>
</>
)
}

export default AppMembers
2 changes: 1 addition & 1 deletion website/src/pages/documents/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import { graphql, navigate } from "gatsby"
import { Skeleton } from "@mantine/core"
import "antd/dist/antd.css"



import { buildMenu, getFileArr } from "../../util"
Expand Down
6 changes: 6 additions & 0 deletions website/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ import AppMedium from '../components/AppMedium'
// import AppShowcase from "../components/AppShowcase"
import Seo from '../components/seo'
import 'aos/dist/aos.css'
import AppCustomers from '../components/AppCustomers'
import AppMembers from '../components/AppGithubMember'
const IndexPage = () => (
<>
<Seo title="纯钧" />
<section className="dark:bg-[#1a1b1e]">
<AppHeader />
<AppBanner />

<AppCards />
<AppMedium />
<AppCustomers />
<AppMembers />

<AppFooter />
</section>
</>
Expand Down
Loading

0 comments on commit 68268a9

Please sign in to comment.