From ce886a3a1589225484ed9baa16a2135071ff48cd Mon Sep 17 00:00:00 2001 From: Jagger <634750802@qq.com> Date: Sun, 8 Sep 2024 16:55:37 +0800 Subject: [PATCH] update --- .../github-campaign/_components/Tabs.tsx | 43 +++++ .../github-campaign/_sections/0-heading.tsx | 13 +- .../_sections/1-how-it-works.tsx | 2 +- .../github-campaign/_sections/2-0-free.mdx | 3 + .../github-campaign/_sections/2-0-you-can.mdx | 8 + .../github-campaign/_sections/2-1-$5.mdx | 2 + .../github-campaign/_sections/2-2-$10.mdx | 1 + .../github-campaign/_sections/2-3-$100.mdx | 1 + .../github-campaign/_sections/2-4-$300.mdx | 2 + .../_sections/2-introduction.tsx | 180 ++++++++++++------ 10 files changed, 192 insertions(+), 63 deletions(-) create mode 100644 web/src/pages/github-campaign/_components/Tabs.tsx create mode 100644 web/src/pages/github-campaign/_sections/2-0-free.mdx create mode 100644 web/src/pages/github-campaign/_sections/2-0-you-can.mdx create mode 100644 web/src/pages/github-campaign/_sections/2-1-$5.mdx create mode 100644 web/src/pages/github-campaign/_sections/2-2-$10.mdx create mode 100644 web/src/pages/github-campaign/_sections/2-3-$100.mdx create mode 100644 web/src/pages/github-campaign/_sections/2-4-$300.mdx diff --git a/web/src/pages/github-campaign/_components/Tabs.tsx b/web/src/pages/github-campaign/_components/Tabs.tsx new file mode 100644 index 00000000000..e1f5fe18578 --- /dev/null +++ b/web/src/pages/github-campaign/_components/Tabs.tsx @@ -0,0 +1,43 @@ +import { styled } from '@mui/material'; +import { motion } from 'framer-motion'; +import React, { createContext, type ReactNode, useContext, useEffect, useState } from 'react'; + +export const TabsContext = createContext<{ init: boolean, current: string, setCurrent: (value: string) => void }>({ init: false, current: '', setCurrent () {} }); + +export function Tabs ({ children, defaultValue }: { children: ReactNode, defaultValue: string }) { + const [current, setCurrent] = useState(defaultValue); + const [init, setInit] = useState(false); + useEffect(() => { + setInit(true); + }, []); + + return ( + + {children} + + ); +} + +export const TabsList = styled('ul')` + list-style: none; + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 24px; + flex-wrap: wrap; + padding: 0 24px; + gap: 12px; +`; + +export function TabItem ({ value, children }: { value: string, children: ReactNode }) { + const { current, setCurrent } = useContext(TabsContext); + + return ( + + {(value === current) && } + + + ); +} diff --git a/web/src/pages/github-campaign/_sections/0-heading.tsx b/web/src/pages/github-campaign/_sections/0-heading.tsx index f0e13051b64..8fef189d447 100644 --- a/web/src/pages/github-campaign/_sections/0-heading.tsx +++ b/web/src/pages/github-campaign/_sections/0-heading.tsx @@ -62,9 +62,16 @@ function PrimaryHeading ({ loading, onClickAction }: { loading: boolean, onClick OSSInsight Logo TiDB Logo - diff --git a/web/src/pages/github-campaign/_sections/1-how-it-works.tsx b/web/src/pages/github-campaign/_sections/1-how-it-works.tsx index 478a7579812..2ec870ef2c2 100644 --- a/web/src/pages/github-campaign/_sections/1-how-it-works.tsx +++ b/web/src/pages/github-campaign/_sections/1-how-it-works.tsx @@ -5,7 +5,7 @@ import React, { Fragment } from 'react'; export function HowItWorks () { return ( - + How it Works diff --git a/web/src/pages/github-campaign/_sections/2-0-free.mdx b/web/src/pages/github-campaign/_sections/2-0-free.mdx new file mode 100644 index 00000000000..2a8265c5fab --- /dev/null +++ b/web/src/pages/github-campaign/_sections/2-0-free.mdx @@ -0,0 +1,3 @@ +- **Personal Website Hosting**: Create websites or blogs using WordPress or Joomla. +- **RAG Agent Prototyping**: Develop RAG agents with your own knowledge base. +- **Minecraft Server**: Run a personal Minecraft server, where you can play on with your friends all day. diff --git a/web/src/pages/github-campaign/_sections/2-0-you-can.mdx b/web/src/pages/github-campaign/_sections/2-0-you-can.mdx new file mode 100644 index 00000000000..8939412d5a7 --- /dev/null +++ b/web/src/pages/github-campaign/_sections/2-0-you-can.mdx @@ -0,0 +1,8 @@ +TiDB Serverless is a highly scalable, vector search built-in, and cost-effective serverless database, which is dedicated to powering modern applications with simple solutions. Read more. + +With it, you can: + +- Build highly scalable applications with ease +- Leverage advanced features like vector search +- Enjoy seamless integration with what you use +- Pay only for what you use, and only beyond free credits diff --git a/web/src/pages/github-campaign/_sections/2-1-$5.mdx b/web/src/pages/github-campaign/_sections/2-1-$5.mdx new file mode 100644 index 00000000000..23f1bed2c02 --- /dev/null +++ b/web/src/pages/github-campaign/_sections/2-1-$5.mdx @@ -0,0 +1,2 @@ +- **Start small businesses**: Power online stores, community forums, or customer feedback systems. +- **Data API Backends**: Host small databases for managing small-scale workloads like API backend \ No newline at end of file diff --git a/web/src/pages/github-campaign/_sections/2-2-$10.mdx b/web/src/pages/github-campaign/_sections/2-2-$10.mdx new file mode 100644 index 00000000000..02c073ceb36 --- /dev/null +++ b/web/src/pages/github-campaign/_sections/2-2-$10.mdx @@ -0,0 +1 @@ +- **Scale startups**: Deploy SaaS applications, analytics dashboards, or e-commerce platforms with of thousands users and continuous read/write operations. \ No newline at end of file diff --git a/web/src/pages/github-campaign/_sections/2-3-$100.mdx b/web/src/pages/github-campaign/_sections/2-3-$100.mdx new file mode 100644 index 00000000000..1c09b759a51 --- /dev/null +++ b/web/src/pages/github-campaign/_sections/2-3-$100.mdx @@ -0,0 +1 @@ +- **Data-heavy applications**: Scale applications with distributed databases, handle enterprise-level systems, or power data-heavy industries like fintech or healthcare. \ No newline at end of file diff --git a/web/src/pages/github-campaign/_sections/2-4-$300.mdx b/web/src/pages/github-campaign/_sections/2-4-$300.mdx new file mode 100644 index 00000000000..08d28cba1ea --- /dev/null +++ b/web/src/pages/github-campaign/_sections/2-4-$300.mdx @@ -0,0 +1,2 @@ +- **Power large-scale enterprises**: Handle millions of users with high performance and reliability requirements. +- **Run mission-critical systems**: Support complex applications like fintech, gaming, or healthcare solutions. \ No newline at end of file diff --git a/web/src/pages/github-campaign/_sections/2-introduction.tsx b/web/src/pages/github-campaign/_sections/2-introduction.tsx index 773ab440e0c..ef55fce90c6 100644 --- a/web/src/pages/github-campaign/_sections/2-introduction.tsx +++ b/web/src/pages/github-campaign/_sections/2-introduction.tsx @@ -1,7 +1,23 @@ import { Button, css, styled } from '@mui/material'; import { Section, SectionContent, SectionTitle } from '@site/src/pages/github-campaign/_components/Section'; import { TiDBCloudButton } from '@site/src/pages/github-campaign/_components/TiDBCloudButton'; -import React from 'react'; +import { AnimatePresence, LayoutGroup, motion } from 'framer-motion'; +import React, { type ReactNode } from 'react'; +import { TabItem, Tabs, TabsContext, TabsList } from '../_components/Tabs'; + +// @ts-expect-error +import Content0 from './2-0-free.mdx'; + +// @ts-expect-error +import YouCan from './2-0-you-can.mdx'; +// @ts-expect-error +import Content1 from './2-1-$5.mdx'; +// @ts-expect-error +import Content2 from './2-2-$10.mdx'; +// @ts-expect-error +import Content3 from './2-3-$100.mdx'; +// @ts-expect-error +import Content4 from './2-4-$300.mdx'; export function IntroductionsSection () { return ( @@ -13,88 +29,134 @@ export function IntroductionsSection () { {image1}
-

- TiDB Serverless is a highly scalable, vector search built-in, and cost-effective serverless database, which is dedicated to powering modern applications with simple solutions. Read more. -

-

- With it, you can: -

-
    -
  • Build highly scalable applications with ease
  • -
  • Leverage advanced features like vector search
  • -
  • Enjoy seamless integration with what you use
  • -
  • Pay only for what you use, and only beyond free credits
  • -
- Try Free + + Try Free
- + With TiDB Serverless credits 💰 , you can: - - {image2} -
-

- Firstly, you can always get started with $0. With TiDB Serverless's generous 25GiB free quota, you can get started any project with ease. -

-
    -
  • -

    With $5-10 💰, people have spinned up ...

    -

    Hackathon projects can be listed here?

    -
  • -
  • -

    With $10 - 100 💰 💰 💰, people are building ....

    -

    Anonymous case studies

    -
  • -
  • -

    With $ 100-300 💰 💰 💰 💰 💰, people can create .....

    -

    ...

    -
  • -
- -
-
+ + + + {tabs.map(tab => {tab.title})} + + + + {image2} + + + {({ init, current }) => ( + + {tabs.map(tab => ( + (!init || current === tab.value) && ( + + {tab.content} + + ) + ))} + + )} + + + + + ); } +const tabs: Array<{ value: string, title: ReactNode, content: ReactNode }> = [ + { + value: 'free', + title: 'Free', + content: , + }, + { + value: '$5', + title: '$5 - $10', + content: , + }, + { + value: '$10', + title: '$10 - $100', + content: , + }, + { + value: '$100', + title: '$100 - $300', + content: , + }, + { + value: '$300', + title: '$300 - $1000', + content: , + }, +]; + const Content = styled('div')<{ invert?: boolean }>` - ${({ theme }) => ({ - [theme.breakpoints.up('md')]: css` - display: flex; - gap: 120px; - `, - })} - margin-top: 80px; + margin-top: 36px; > article { order: 2; + } + + > svg { + display: none; + } + + article { font-size: 24px; line-height: 41px; strong { - color: #FFE895; } - a:not(.MuiButtonBase-root ) { + a:not(.MuiButtonBase-root) { color: #FFE895; text-decoration: underline; } - } - > svg { - flex-shrink: 0; - display: block; - margin: 0 auto; - order: ${({ invert }) => invert ? 3 : 1}; + .MuiButtonBase-root { + width: 100%; + } } + + ${({ theme, invert }) => ({ + [theme.breakpoints.up('md')]: css` + margin-top: 80px; + + display: flex; + gap: 120px; + + > svg { + flex-shrink: 0; + display: block; + margin: 0 auto; + order: ${invert ? 3 : 1}; + } + + > article { + .MuiButtonBase-root { + width: max-content; + } + } + `, + })} `; const image1 =