diff --git a/docs/.dumi/app.tsx b/docs/.dumi/app.tsx new file mode 100644 index 000000000000..38950adc3380 --- /dev/null +++ b/docs/.dumi/app.tsx @@ -0,0 +1,8 @@ +import { Navigate } from 'dumi'; + +export function patchClientRoutes({ routes }) { + routes.push({ + path: '/docs/tutorials/getting-started', + element: , + }); +} diff --git a/docs/components/Contributing/Contributing.tsx b/docs/.dumi/components/Contributing/index.tsx similarity index 58% rename from docs/components/Contributing/Contributing.tsx rename to docs/.dumi/components/Contributing/index.tsx index 912e919930e0..635fef26d1bc 100644 --- a/docs/components/Contributing/Contributing.tsx +++ b/docs/.dumi/components/Contributing/index.tsx @@ -1,16 +1,29 @@ -import SectionHeader from '@/docs/components/SectionHeader/SectionHeader'; import React from 'react'; -// @ts-ignore +import styled from 'styled-components'; import { Link } from 'umi'; -// @ts-ignore -import styles from './Contributing.css'; +import { SectionHeader } from '../SectionHeader'; -export default () => { +const ContributingWrapper = styled.div` + max-width: 1200px; + margin: 0 auto 60px; + p { + font-size: 18px; + color: #4a5e71; + margin-bottom: 16px; + } + + p a { + color: #0273dc; + text-decoration: none; + } +`; + +export const Contributing = () => { return ( -
+
-

+

社区有非常多小伙伴在和我们一同建设 Umi,如果你有兴趣,欢迎  加入我们 。

@@ -24,6 +37,6 @@ export default () => {
- + ); }; diff --git a/docs/.dumi/components/Features/image.ts b/docs/.dumi/components/Features/image.ts new file mode 100644 index 000000000000..0637613a9d84 --- /dev/null +++ b/docs/.dumi/components/Features/image.ts @@ -0,0 +1,23 @@ +export const BOX_IMAGE = + 'https://img.alicdn.com/imgextra/i1/O1CN01X9PWb51WTrmbiflpT_!!6000000002790-2-tps-200-200.png'; + +export const COMPANY_IMAGE = + 'https://img.alicdn.com/imgextra/i3/O1CN01bQ0kTe1EBOjKuXpqp_!!6000000000313-2-tps-200-202.png'; + +export const PRACTICE_IMAGE = + 'https://img.alicdn.com/imgextra/i2/O1CN013xl2111M1nLrWyeFh_!!6000000001375-2-tps-200-202.png'; + +export const EXPAND_IMAGE = + 'https://img.alicdn.com/imgextra/i2/O1CN01u39OgG1KsLZ2sIJMg_!!6000000001219-2-tps-200-202.png'; + +export const ROUTER_IMAGE = + 'https://img.alicdn.com/imgextra/i4/O1CN01h5IQ8c1mll6tVqVhQ_!!6000000004995-2-tps-200-200.png'; + +export const FAST_IMAGE = + 'https://img.alicdn.com/imgextra/i1/O1CN01y7KgLZ26MNTamgba7_!!6000000007647-2-tps-200-200.png'; + +export const ENGINE_IMAGE = + 'https://img.alicdn.com/imgextra/i4/O1CN016Wo1XZ1dSg4HhJn0M_!!6000000003735-2-tps-200-200.png'; + +export const PACK_IMAGE = + 'https://img.alicdn.com/imgextra/i2/O1CN01ub7E7l1QT3O8vEbCq_!!6000000001976-2-tps-200-200.png'; diff --git a/docs/.dumi/components/Features/index.tsx b/docs/.dumi/components/Features/index.tsx new file mode 100644 index 000000000000..633d8fa2047d --- /dev/null +++ b/docs/.dumi/components/Features/index.tsx @@ -0,0 +1,130 @@ +import React from 'react'; +import styled from 'styled-components'; +import { SectionHeader } from '../SectionHeader'; +import { + BOX_IMAGE, + COMPANY_IMAGE, + ENGINE_IMAGE, + EXPAND_IMAGE, + FAST_IMAGE, + PACK_IMAGE, + PRACTICE_IMAGE, + ROUTER_IMAGE, +} from './image'; + +const FeaturesWrapper = styled.div` + max-width: 1200px; + margin: 0 auto; + ul { + display: flex; + flex-wrap: wrap; + gap: 26px; + padding-top: 40px; + padding-bottom: 40px; + padding-left: 0; + justify-content: center; + } + + .feature { + width: 280px; + margin-bottom: 60px; + list-style: none; + } + + .feature div { + width: 100px; + height: 100px; + background-size: 100px 100px; + background-repeat: no-repeat; + margin: 0 auto 10px; + } + + .feature h3 { + font-size: 20px; + color: #2a445d; + margin-bottom: 12px; + text-align: center; + } + .feature p { + font-size: 18px; + color: #4a5e71; + } +`; + +const FeatureItemPicture = styled.div<{ imageUrl: string }>` + background-image: url(${(props) => props.imageUrl}); +`; + +export const Features = () => { + return ( + + +
    +
  • + +

    开箱即用

    +

    + 内置路由、构建、部署、测试、Lint 等,仅需一个 Umi 依赖即可上手开发。 +

    +
  • +
  • + +

    企业级

    +

    + 蚂蚁集团 10000+ + 应用的选择。同时也在阿里、字节、腾讯、网易、美团、快手等公司有大量应用。 +

    +
  • +
  • + +

    最佳实践

    +

    + 内置微前端、数据流、权限、国际化、icons 方案、埋点、antd、请求、CSS + 方案、图表等最佳实践。 +

    +
  • +
  • + +

    可扩展

    +

    + Umi 实现了 web 应用开发的完整生命周期,并使之插件化,包括 Umi + 内部功能也是全由插件实现。 +

    +
  • +
  • + +

    完备路由

    +

    + 基于 React Router 6,类 + Remix,支持嵌套、动态、动态可选、预加载、基于路由的请求优化等。 +

    +
  • +
  • + +

    默认快

    +

    + MFSU 解 Webpack 编译慢的问题,通过 esbuild + 解压缩、配置、测试的性能问题,还有运行时... +

    +
  • +
  • + +

    双构建引擎

    +

    + 提供 Vite 和 Webpack + 两种构建模式供开发者选择,并尽可能保证他们之间功能的一致性。 +

    +
  • +
  • + +

    依赖预打包

    +

    + Umi + 针对依赖做了预打包处理,彻底地锁定依赖,定期更新,让框架的每个版本在 + 10 年后依旧可用。 +

    +
  • +
+
+ ); +}; diff --git a/docs/.dumi/components/Footer/NewsLetterForm.tsx b/docs/.dumi/components/Footer/NewsLetterForm.tsx new file mode 100644 index 000000000000..ae4a47f81a06 --- /dev/null +++ b/docs/.dumi/components/Footer/NewsLetterForm.tsx @@ -0,0 +1,67 @@ +import React from 'react'; +import styled from 'styled-components'; + +const NewsLetterFormWrapper = styled.div` + font-size: 18px; + margin-bottom: 14px; + h2 { + font-size: 18px; + font-weight: 400; + } + input { + background: #ffffff; + border: 1px solid #bac1c8; + width: 180px; + font-size: 14px; + height: 28px; + line-height: 28px; + padding: 0 4px; + } + + button { + font-size: 14px; + color: #ffffff; + margin-left: 14px; + background-image: linear-gradient( + 224deg, + #0071da 0%, + #1890ff 100%, + #1890ff 100% + ); + height: 28px; + line-height: 28px; + padding: 0 10px; + border: none; + } + + button:hover { + background-image: linear-gradient( + 224deg, + #48a4fe 0%, + #6fbafe 100%, + #8dc9ff 100% + ); + } +`; + +export const NewsLetterForm = () => { + return ( + +

订阅 Umi 的最新动态

+
+ + +
+
+ ); +}; diff --git a/docs/.dumi/components/Footer/index.tsx b/docs/.dumi/components/Footer/index.tsx new file mode 100644 index 000000000000..6ae19db27bec --- /dev/null +++ b/docs/.dumi/components/Footer/index.tsx @@ -0,0 +1,97 @@ +import React from 'react'; +import styled from 'styled-components'; +import { Link } from 'umi'; +import { NewsLetterForm } from './NewsLetterForm'; + +const FooterWrapper = styled.div` + padding: 40px 0; + .foot-wrapper { + display: flex; + max-width: 1200px; + margin: 0 auto; + .left { + flex: 1; + .line { + line-height: 40px; + display: flex; + } + + .line h3 { + font-size: 18px; + width: 92px; + margin-right: 66px; + margin-top: 0; + margin-bottom: 0; + font-weight: 400; + color: #4a5e71; + } + + .line div { + flex: 1; + color: #4a5e71; + } + + .line div a { + text-decoration: none; + color: #4a5e71; + } + } + + .right { + min-width: 400px; + font-size: 16px; + .copyright { + font-size: 14px; + color: #8996a1; + line-height: 22px; + margin-top: 24px; + } + } + } +`; + +export const Footer = () => { + return ( + +
+
+
+

文档和帮助

+
+ + 反馈和交流群 + {' '} + ·{' '} + + 给 Umi 提 Bug + {' '} + · 向 Umi 贡献代码 ·{' '} + 升级到 Umi 4 +
+
+
+

Umi 生态

+
+ 开发日志 · 团队 · 里程碑 ·{' '} + + 乾坤 + +
+
+
+

Umi 资源

+
+ 文档 · 示例 · 插件 ·{' '} + + 发布日志 + +
+
+
+
+ +
+
+
+ ); +}; diff --git a/docs/.dumi/components/Hero/GithubStar.tsx b/docs/.dumi/components/Hero/GithubStar.tsx new file mode 100644 index 000000000000..fcedca583bf7 --- /dev/null +++ b/docs/.dumi/components/Hero/GithubStar.tsx @@ -0,0 +1,30 @@ +import React, { useEffect, useState } from 'react'; +import CountUp from 'react-countup'; + +const LS_KEY = 'github-stars'; + +export const GithubStar = () => { + const [count, setCount] = useState(localStorage.getItem(LS_KEY) || '12K+'); + + useEffect(() => { + (async () => { + try { + const res = await fetch('https://api.github.com/repos/umijs/umi'); + const count = (await res.json()).stargazers_count; + if (count) { + setCount(count); + localStorage.setItem(LS_KEY, count); + } + } catch (e) { + setCount('0'); + localStorage.setItem(LS_KEY, '0'); + } + })(); + }, []); + + return ( + + Github Stars + + ); +}; diff --git a/docs/.dumi/components/Hero/image.ts b/docs/.dumi/components/Hero/image.ts new file mode 100644 index 000000000000..f96d7cd73015 --- /dev/null +++ b/docs/.dumi/components/Hero/image.ts @@ -0,0 +1,17 @@ +export const BG_IMAGE = + 'https://img.alicdn.com/imgextra/i4/O1CN01Ri0dNS26K5UcRKrrU_!!6000000007642-2-tps-280-1400.png'; + +export const BIG_LOGE_IMAGE = + 'https://img.alicdn.com/imgextra/i4/O1CN01Gk5nSa1nkDO5AjXlN_!!6000000005127-2-tps-920-426.png'; + +export const GITHUB_STAR_IMAGE = + 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTEyIDBDNS4zNzQgMCAwIDUuMzczIDAgMTJjMCA1LjMwMiAzLjQzOCA5LjggOC4yMDcgMTEuMzg3LjU5OS4xMTEuNzkzLS4yNjEuNzkzLS41Nzd2LTIuMjM0Yy0zLjMzOC43MjYtNC4wMzMtMS40MTYtNC4wMzMtMS40MTYtLjU0Ni0xLjM4Ny0xLjMzMy0xLjc1Ni0xLjMzMy0xLjc1Ni0xLjA4OS0uNzQ1LjA4My0uNzI5LjA4My0uNzI5IDEuMjA1LjA4NCAxLjgzOSAxLjIzNyAxLjgzOSAxLjIzNyAxLjA3IDEuODM0IDIuODA3IDEuMzA0IDMuNDkyLjk5Ny4xMDctLjc3NS40MTgtMS4zMDUuNzYyLTEuNjA0LTIuNjY1LS4zMDUtNS40NjctMS4zMzQtNS40NjctNS45MzEgMC0xLjMxMS40NjktMi4zODEgMS4yMzYtMy4yMjEtLjEyNC0uMzAzLS41MzUtMS41MjQuMTE3LTMuMTc2IDAgMCAxLjAwOC0uMzIyIDMuMzAxIDEuMjNBMTEuNTA5IDExLjUwOSAwIDAgMSAxMiA1LjgwM2MxLjAyLjAwNSAyLjA0Ny4xMzggMy4wMDYuNDA0IDIuMjkxLTEuNTUyIDMuMjk3LTEuMjMgMy4yOTctMS4yMy42NTMgMS42NTMuMjQyIDIuODc0LjExOCAzLjE3Ni43Ny44NCAxLjIzNSAxLjkxMSAxLjIzNSAzLjIyMSAwIDQuNjA5LTIuODA3IDUuNjI0LTUuNDc5IDUuOTIxLjQzLjM3Mi44MjMgMS4xMDIuODIzIDIuMjIydjMuMjkzYzAgLjMxOS4xOTIuNjk0LjgwMS41NzZDMjAuNTY2IDIxLjc5NyAyNCAxNy4zIDI0IDEyYzAtNi42MjctNS4zNzMtMTItMTItMTJ6Ii8+PC9zdmc+'; + +export const BIG_SLOGAN1_IMAGE = + 'https://img.alicdn.com/imgextra/i4/O1CN01AYMMmi1d4P4hiTpYK_!!6000000003682-2-tps-468-152.png'; + +export const BIG_SLOGAN2_IMAGE = + 'https://img.alicdn.com/imgextra/i4/O1CN011JiaU21wvVhMqXI4G_!!6000000006370-2-tps-700-116.png'; + +export const BOW_IMAGE = + 'https://img.alicdn.com/imgextra/i3/O1CN01L7phqd1ud4WehHiRc_!!6000000006059-2-tps-760-386.png'; diff --git a/docs/.dumi/components/Hero/index.tsx b/docs/.dumi/components/Hero/index.tsx new file mode 100644 index 000000000000..7c2dfd7ac963 --- /dev/null +++ b/docs/.dumi/components/Hero/index.tsx @@ -0,0 +1,179 @@ +import React from 'react'; +import { TextLoop } from 'react-text-loop-next'; +import styled from 'styled-components'; +import { Link } from 'umi'; +import { GithubStar } from './GithubStar'; +import { + BG_IMAGE, + BIG_LOGE_IMAGE, + BIG_SLOGAN1_IMAGE, + BIG_SLOGAN2_IMAGE, + BOW_IMAGE, + GITHUB_STAR_IMAGE, +} from './image'; + +const HeroWrapper = styled.div` + height: 640px; + position: relative; + .bg { + position: absolute; + left: 0; + top: 0; + width: 100%; + background: url('${BG_IMAGE}') repeat-x; + background-position: 0 -40px; + background-size: 140px 700px; + height: 640px; + z-index: 1; + } + .wrapper { + position: relative; + max-width: 1200px; + margin: 0 auto; + display: flex; + z-index: 2; + .left { + flex: 1; + padding-top: 130px; + padding-left: 90px; + .bigLogo { + width: 460px; + height: 213px; + background: url('${BIG_LOGE_IMAGE}') no-repeat; + background-size: 460px 213px; + } + + .actions { + margin-top: 87px; + display: flex; + .button { + background-image: linear-gradient( + 224deg, + #0071da 0%, + #1890ff 100%, + #1890ff 100% + ); + width: 180px; + height: 54px; + line-height: 54px; + text-align: center; + color: #fff; + font-size: 22px; + margin-left: 27px; + } + .button:hover { + background-image: linear-gradient( + 224deg, + #48a4fe 0%, + #6fbafe 100%, + #8dc9ff 100% + ); + } + .githubStar { + display: flex; + font-size: 18px; + color: #4a5e71; + margin-left: 40px; + line-height: 54px; + /*padding-left: 28px;*/ + /*background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTEyIDBDNS4zNzQgMCAwIDUuMzczIDAgMTJjMCA1LjMwMiAzLjQzOCA5LjggOC4yMDcgMTEuMzg3LjU5OS4xMTEuNzkzLS4yNjEuNzkzLS41Nzd2LTIuMjM0Yy0zLjMzOC43MjYtNC4wMzMtMS40MTYtNC4wMzMtMS40MTYtLjU0Ni0xLjM4Ny0xLjMzMy0xLjc1Ni0xLjMzMy0xLjc1Ni0xLjA4OS0uNzQ1LjA4My0uNzI5LjA4My0uNzI5IDEuMjA1LjA4NCAxLjgzOSAxLjIzNyAxLjgzOSAxLjIzNyAxLjA3IDEuODM0IDIuODA3IDEuMzA0IDMuNDkyLjk5Ny4xMDctLjc3NS40MTgtMS4zMDUuNzYyLTEuNjA0LTIuNjY1LS4zMDUtNS40NjctMS4zMzQtNS40NjctNS45MzEgMC0xLjMxMS40NjktMi4zODEgMS4yMzYtMy4yMjEtLjEyNC0uMzAzLS41MzUtMS41MjQuMTE3LTMuMTc2IDAgMCAxLjAwOC0uMzIyIDMuMzAxIDEuMjNBMTEuNTA5IDExLjUwOSAwIDAgMSAxMiA1LjgwM2MxLjAyLjAwNSAyLjA0Ny4xMzggMy4wMDYuNDA0IDIuMjkxLTEuNTUyIDMuMjk3LTEuMjMgMy4yOTctMS4yMy42NTMgMS42NTMuMjQyIDIuODc0LjExOCAzLjE3Ni43Ny44NCAxLjIzNSAxLjkxMSAxLjIzNSAzLjIyMSAwIDQuNjA5LTIuODA3IDUuNjI0LTUuNDc5IDUuOTIxLjQzLjM3Mi44MjMgMS4xMDIuODIzIDIuMjIydjMuMjkzYzAgLjMxOS4xOTIuNjk0LjgwMS41NzZDMjAuNTY2IDIxLjc5NyAyNCAxNy4zIDI0IDEyYzAtNi42MjctNS4zNzMtMTItMTItMTJ6Ii8+PC9zdmc+) no-repeat 0 center;*/ + /*background-size: 24px 24px;*/ + } + .githubStar:before { + background: url('${GITHUB_STAR_IMAGE}') no-repeat 0 center; + background-size: 24px 24px; + width: 24px; + height: 54px; + display: inline-block; + content: ''; + margin-right: 6px; + } + } + .actions a { + text-decoration: none; + } + } + .right { + width: 460px; + padding-top: 90px; + margin-right: 40px; + .bigSlogan1 { + background: url('${BIG_SLOGAN1_IMAGE}') no-repeat; + width: 234px; + height: 76px; + background-size: 234px 76px; + margin: 0 auto 6px; + } + + .bigSlogan2 { + background: url('${BIG_SLOGAN2_IMAGE}') no-repeat; + width: 350px; + height: 58px; + background-size: 350px 58px; + margin: 0 auto 14px; + } + + .slogan { + font-size: 25px; + color: #708293; + text-align: center; + width: 460px; + } + .slogan strong { + color: #0273dc; + font-weight: normal; + } + .bow { + background: url('${BOW_IMAGE}') no-repeat; + width: 380px; + height: 193px; + background-size: 380px 193px; + margin: 8px auto 0; + } + } + } +`; +export const Hero = () => { + // TODO: github stars 存 localStorage + // 采用 stale-while-revalidate 的策略 + return ( + +
+
+
+
+
+ +
快速上手 →
+ +
+ +
+
+
+
+
+
+
+ 用 Umi 构建你的下一个{' '} + + React + Vue + PC + Mobile + SPA + SSR + CSR + 中后台 + {' '} + 应用 +
+
+ 带给你简单愉悦的 Web 开发体验 +
+
+
+
+ + ); +}; diff --git a/docs/.dumi/components/SectionHeader/index.tsx b/docs/.dumi/components/SectionHeader/index.tsx new file mode 100644 index 000000000000..860111c2770e --- /dev/null +++ b/docs/.dumi/components/SectionHeader/index.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import styled from 'styled-components'; + +const SectionHeaderWrapper = styled.div` + display: flex; + margin-bottom: 40px; + div { + flex: 1; + border-top: 1px solid #ebf0f4; + height: 1px; + margin-top: 18px; + } + + h2 { + font-size: 26px; + color: #2a445d; + text-align: center; + padding: 0 20px; + margin: 0; + font-weight: 400; + } +`; + +export const SectionHeader = (props: { title: string }) => { + return ( + +
+

{props.title}

+
+
+ ); +}; diff --git a/docs/components/WhoIsUsing/WhoIsUsing.tsx b/docs/.dumi/components/WhoIsUsing/index.tsx similarity index 80% rename from docs/components/WhoIsUsing/WhoIsUsing.tsx rename to docs/.dumi/components/WhoIsUsing/index.tsx index 31ebdb392c7e..56b9317fc4f2 100644 --- a/docs/components/WhoIsUsing/WhoIsUsing.tsx +++ b/docs/.dumi/components/WhoIsUsing/index.tsx @@ -1,13 +1,29 @@ -import SectionHeader from '@/docs/components/SectionHeader/SectionHeader'; import React from 'react'; -// @ts-ignore -import styles from './WhoIsUsing.css'; +import styled from 'styled-components'; +import { SectionHeader } from '../SectionHeader'; -export default () => { +const WhoIsUsingWrapper = styled.div` + max-width: 1200px; + margin: 0 auto 60px; + ul { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 20px; + list-style: none; + padding: 0; + li img { + width: 224px; + height: 81px; + margin: -8px; + } + } +`; +export const WhoIsUsing = () => { return ( -
+ -
    +
    • 蚂蚁集团 { />
    -
+ ); }; diff --git a/docs/.dumi/pages/index.tsx b/docs/.dumi/pages/index.tsx new file mode 100644 index 000000000000..09ca51ffb08c --- /dev/null +++ b/docs/.dumi/pages/index.tsx @@ -0,0 +1,60 @@ +/** + * title: UmiJS - 插件化的企业级前端应用框架 + */ +import React from 'react'; +import { createGlobalStyle } from 'styled-components'; +import { Contributing } from '../components/Contributing'; +import { Features } from '../components/Features'; +import { Footer } from '../components/Footer'; +import { Hero } from '../components/Hero'; +import { WhoIsUsing } from '../components/WhoIsUsing'; + +const GlobalStyle = createGlobalStyle` + html[data-prefers-color='dark']{ + .bg { + opacity: 0.1; + } + .bigLogo{ + opacity: 0.8; + } + .githubStar,.section-header-title { + color: rgba(255, 255, 255, 0.7) !important; + } + .section-header-line{ + border-top-color: rgba(255, 255, 255, 0.7) !important; + } + .githubStar:before { + filter: invert(80%); + } + .slogan, .contributing-text, .feature h3, .feature p { + color: rgba(255, 255, 255, 0.8)!important; + } + .bow { + opacity: 0.8; + } + .using-list li { + background-color: rgba(255, 255, 255, 0.2); + overflow: auto; + } + .foot-wrapper { + .left .line h3, .left .line div, .left .line div a { + color: rgba(255, 255, 255, 0.8)!important; + } + } + } +`; + +const Index = () => { + return ( + <> + + + + + +