Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

website UI #1788

Merged
merged 47 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
30e329d
feat: update the hero title
TwilightLogic May 9, 2024
6d3c804
feat: add logic on rendering slogan
TwilightLogic May 9, 2024
1bf05d6
feat: complete the website layout
TwilightLogic May 9, 2024
35ae429
feat: add some props to the landing page
TwilightLogic May 9, 2024
e3c0b66
feat: add some contents to landing page
TwilightLogic May 9, 2024
22a56ff
feat: add some props to the landing page
TwilightLogic May 11, 2024
af60eb7
feat: complete the features page
TwilightLogic May 11, 2024
a470365
feat: complete the Explore page
TwilightLogic May 11, 2024
ca2ea45
feat: complete the Ecosystem page
TwilightLogic May 11, 2024
a6ae879
feat: complete the Ecosystem page on mobile devices
TwilightLogic May 11, 2024
6963350
feat: complete the Blogs layout
TwilightLogic May 11, 2024
810d929
feat: complete the Blogs component
TwilightLogic May 11, 2024
64a2c11
feat: update the display style on Explore component
TwilightLogic May 11, 2024
cffeb22
refactor: remove background and update hovering styles on Blog
TwilightLogic May 13, 2024
abd9702
feat: complete the dark mode on Features
TwilightLogic May 13, 2024
7458c00
feat: complete the dark mode on Explore
TwilightLogic May 13, 2024
172a521
feat: improve the dark mode UI on Explore
TwilightLogic May 13, 2024
a1b622f
feat: complete the dark mode on Blog
TwilightLogic May 13, 2024
446b4f4
feat: update some styles on landing page
TwilightLogic May 13, 2024
a66ea2e
feat: complete the Chinese version
TwilightLogic May 13, 2024
3682986
feat: complete the UI design
TwilightLogic May 14, 2024
7f677ec
feat: add "antialiased" style
TwilightLogic May 14, 2024
c09c0ea
feat: highlight the specific Chinese
TwilightLogic May 14, 2024
24ba3f5
feat: add specific highlight color
TwilightLogic May 14, 2024
4508a78
refactor: update the icons on features
TwilightLogic May 14, 2024
603f8f5
rewrite the learn docs
Mine77 May 15, 2024
9ded138
chore: merge main into website-ui
TwilightLogic May 30, 2024
05e0588
chore: merge main into website-ui
TwilightLogic May 30, 2024
957d79b
refactor: complete the hero page
TwilightLogic May 30, 2024
9cb948d
refactor: complete the feature page
TwilightLogic May 30, 2024
e1781ca
refactor: complete the explpore page
TwilightLogic May 30, 2024
c076e60
refactor: complete the hero page
TwilightLogic May 30, 2024
1a8c0d2
refactor: complete the features page
TwilightLogic May 30, 2024
e066409
refactor: complete the explore page
TwilightLogic May 30, 2024
7c44594
refactor: complete the features page
TwilightLogic May 30, 2024
27e1045
refactor: complete the features page
TwilightLogic May 30, 2024
3fdfd0b
refactor: complete the navbar
TwilightLogic May 30, 2024
26a2a81
refactor: update some styles
TwilightLogic May 31, 2024
57a5490
refactor: merge main into website-ui
TwilightLogic May 31, 2024
812ab59
feat: update some content
TwilightLogic May 31, 2024
bb00444
feat: add some content
TwilightLogic May 31, 2024
9aaa2c0
feat: update the highlight title
TwilightLogic May 31, 2024
5b97b9d
feat: update the highlight title
TwilightLogic May 31, 2024
f35d02d
feat: add button for features section
TwilightLogic May 31, 2024
1460c12
feat: update some UI for features section
TwilightLogic May 31, 2024
b9edd37
feat: add some content
TwilightLogic Jun 1, 2024
906cb2f
feat: update the logo for Babylon
TwilightLogic Jun 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 105 additions & 63 deletions docs/website/components/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface IndexProps {
// EXPLORE
exploreTitle: string
exploreContent: string
exploreButtonHref: string
explores: Card[]

// ECOSYSTEM
Expand All @@ -60,61 +61,71 @@ const Index = ({
features,
exploreTitle,
exploreContent,
exploreButtonHref,
explores,
ecosystemTitle,
ecosystemContent,
// ecosystemContent,
ecosystemBrand,
blogsTitle,
blogs,
}: IndexProps) => {
// Function to check if the string contains Chinese characters
const containsChinese = (text: string) => /[\u4e00-\u9fa5]/.test(text)

const highlightSpecificWords = (
const highlightSpecificPhrases = (
text: string,
wordsToHighlight: string[],
phrasesToHighlight: string[],
highlightColor: string,
) => {
if (!containsChinese(text)) return text // Only process if it's Chinese text
return (
<>
{text.split('').map((char, index) =>
wordsToHighlight.includes(char) ? (
<span key={index} style={{ color: highlightColor }}>
{char}
</span>
) : (
char
),
)}
</>
)
let result = text
phrasesToHighlight.forEach((phrase) => {
const regex = new RegExp(`(${phrase})`, 'g')
result = result.replace(regex, `<span style="color: ${highlightColor};">$1</span>`)
})
return <span dangerouslySetInnerHTML={{ __html: result }} />
}

const highlightTitle = (title: string, wordsToHighlight: string[], highlightColor: string) => {
const highlightTitle = (
title: string,
phrasesToHighlightChinese: string[],
phrasesToHighlightEnglish: string[],
highlightColor: string,
) => {
if (containsChinese(title)) {
return highlightSpecificWords(title, wordsToHighlight, highlightColor)
} else {
const words = title.split(' ')
return (
<>
{words.slice(0, -1).join(' ')}{' '}
<span style={{ color: highlightColor }}>{words.slice(-1).join(' ')}</span>
{words.map((word, index) =>
phrasesToHighlightEnglish.includes(word) ? (
<span key={index} style={{ color: highlightColor }}>
{word}{' '}
</span>
) : (
word + ' '
),
)}
</>
)
}
}

const handleFeaturesButtonOnClick = (href: string) => {
const handleButtonOnClick = (href: string) => {
console.log(href)
window.open(href)
}

// Define words to highlight for Chinese text
const wordsToHighlightForFeatures = ['比', '特', '币']
const wordsToHighlightForExplore = ['新', '型', '架', '构']
const wordsToHighlightForEcosystem = ['生', '态']
const wordsToHighlightForBlogs = ['博', '客']
// Define phrases to highlight for Chinese text
const phrasesToHighlightForFeaturesChinese = ['比特币生态']
const phrasesToHighlightForExploreChinese = ['状态', '应用']
const phrasesToHighlightForEcosystemChinese = ['合作伙伴']
const phrasesToHighlightForBlogsChinese = ['博客']

// Define phrases to highlight for English text
const phrasesToHighlightForFeaturesEnglish = ['Bitcoin', 'Ecosystem']
const phrasesToHighlightForExploreEnglish = ['State', 'App']
const phrasesToHighlightForEcosystemEnglish = ['Partnerships']
const phrasesToHighlightForBlogsEnglish = ['Blog']

const highlightColor = '#FF914B'
const highlightColorForExplore = '#46977E'
Expand All @@ -126,7 +137,7 @@ const Index = ({
<div className="mt-28 md:mt-0 flex flex-col md:flex-row items-center justify-center md:justify-between h-full md:h-[90vh] px-4 sm:px-6 md:px-8 lg:px-20 dark:border-b dark:border-b-zinc-800">
<div className="flex flex-col items-center justify-center">
<div className="mt-5 max-w-3xl text-center mx-auto">
<p className="block font-bold text-gray-800 text-4xl md:text-5xl lg:text-5xl dark:text-gray-200">
<p className="block font-bold text-gray-800 text-4xl md:text-5xl lg:text-6xl dark:text-gray-200">
{heroTitle}
</p>
{heroSlogan ? (
Expand Down Expand Up @@ -155,7 +166,7 @@ const Index = ({
</Link>
</div>
</div>
<div className="md:w-3/5 w-full my-12 md:my-0">
<div className="md:w-1/2 w-full my-12 md:my-0">
<img src="/logo/hero/hero.svg" alt="hero" />
</div>
</div>
Expand All @@ -164,14 +175,18 @@ const Index = ({
<div className="py-16 md:py-20 px-4 sm:px-6 md:px-8 lg:px-20 bg-[#F5F5F5] dark:bg-inherit flex flex-col md:flex-row items-center justify-between gap-12 md:gap-8 dark:border-b dark:border-b-zinc-800">
<div className="px-4 max-w-[900px] w-full h-full">
<h2 className="text-4xl md:text-6xl font-semibold text-center md:text-start text-[#2E2929] dark:text-[#EEEBEB]">
{highlightTitle(featuresTitle, wordsToHighlightForFeatures, highlightColor)}
{highlightTitle(
featuresTitle,
phrasesToHighlightForFeaturesChinese,
phrasesToHighlightForFeaturesEnglish,
highlightColor,
)}
</h2>
<div className="mt-12 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
{features?.map((feature) => (
<div
key={feature.title}
className="flex flex-col items-center md:items-start justify-center md:justify-start bg-white dark:bg-[#333] p-6 rounded-2xl shadow-md hover:shadow-lg overflow-hidden hover:cursor-pointer h-full dark:hover:bg-[#555] transition-all relative"
onClick={() => handleFeaturesButtonOnClick(feature.buttonHref)}
className="flex flex-col items-center md:items-start justify-center md:justify-start space-y-3 bg-white dark:bg-[#333] p-6 rounded-2xl shadow-md overflow-hidden h-full hover:cursor-default"
>
<div className="w-12 h-12 md:w-16 md:h-16 mb-4">
<Image
Expand All @@ -185,25 +200,31 @@ const Index = ({
<h3 className="md:text-2xl text-[#FF914B] text-center md:text-start mb-2 font-bold text-2xl leading-7">
{feature.title}
</h3>
<p className="text-gray-600 text-center md:text-start dark:text-[#EAEAEA]">
{feature.description}
</p>
{/*<div className="hidden md:block md:absolute bottom-5 left-6">*/}
{/* <svg*/}
{/* className="w-5 h-5 md:w-4 md:h-4 text-gray-400"*/}
{/* width="16"*/}
{/* height="16"*/}
{/* viewBox="0 0 16 16"*/}
{/* fill="none"*/}
{/* >*/}
{/* <path*/}
{/* d="M5.27921 2L10.9257 7.64645C11.1209 7.84171 11.1209 8.15829 10.9257 8.35355L5.27921 14"*/}
{/* stroke="currentColor"*/}
{/* strokeWidth="2"*/}
{/* strokeLinecap="round"*/}
{/* />*/}
{/* </svg>*/}
{/*</div>*/}
<div className="text-gray-600 text-center md:text-start dark:text-[#EAEAEA]">
<p>{feature.description}</p>
</div>
<div className="flex items-end justify-end h-full w-full">
<div
className="font-semibold text-[#2E2929] dark:text-[#EEEBEB] hover:cursor-pointer flex items-center justify-center space-x-2 hover:underline transition-all"
onClick={() => handleButtonOnClick(feature.buttonHref)}
>
<span>{feature.buttonDesc}</span>
<svg
className="w-3 h-3"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
>
<path
d="M5.27921 2L10.9257 7.64645C11.1209 7.84171 11.1209 8.15829 10.9257 8.35355L5.27921 14"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
/>
</svg>
</div>
</div>
</div>
))}
</div>
Expand All @@ -221,7 +242,12 @@ const Index = ({
<div className="py-20 px-4 sm:px-6 md:px-8 lg:px-20 bg-white dark:bg-inherit flex flex-col md:flex-row items-center justify-center gap-6 md:gap-8 dark:border-b dark:border-b-zinc-800">
<div className="px-4 max-w-[854px] w-full h-full">
<h2 className="text-4xl md:text-6xl font-semibold text-center text-[#2E2929] dark:text-[#E4E4E4]">
{highlightTitle(exploreTitle, wordsToHighlightForExplore, highlightColorForExplore)}
{highlightTitle(
exploreTitle,
phrasesToHighlightForExploreChinese,
phrasesToHighlightForExploreEnglish,
highlightColorForExplore,
)}
</h2>
<div className="flex flex-col items-center justify-center md:justify-start gap-6 mt-8">
<h3 className="text-[#737B7D] dark:text-[#81888A] text-base font-normal max-w-2xl text-center">
Expand All @@ -230,10 +256,18 @@ const Index = ({
<img
src="/logo/explore/explore_logo.svg"
alt="explore logo"
className="w-full md:w-9/12 h-full"
className="w-full md:w-9/12 h-full dark:hidden block"
/>
<img
src="/logo/explore/explore_logo_dark.svg"
alt="explore logo"
className="w-full md:w-9/12 h-full hidden dark:block"
/>
<div className="mt-8 h-12">
<button className="px-8 py-4 bg-[#FF914B] font-bold text-lg text-center rounded-full border border-1 border-b-[6px] border-black active:border-b-4 active:transform active:translate-y-0.5 hover:shadow-custom1 dark:border-white dark:shadow-custom1 transition-all">
<button
className="px-8 py-4 bg-[#FF914B] font-bold text-lg text-center rounded-full border border-1 border-b-[6px] border-black active:border-b-4 active:transform active:translate-y-0.5 hover:shadow-custom1 dark:border-white dark:shadow-custom1 transition-all"
onClick={() => handleButtonOnClick(exploreButtonHref)}
>
{featuresButton}
</button>
</div>
Expand Down Expand Up @@ -261,16 +295,21 @@ const Index = ({
<div className="py-20 px-4 sm:px-6 md:px-8 lg:px-20 flex flex-col items-center justify-center gap-6 md:gap-0 bg-[#F5F5F5] dark:bg-inherit w-full dark:border-b dark:border-b-zinc-800">
<div className="flex flex-col items-center justify-center h-full gap-2">
<h2 className="text-4xl md:text-6xl font-semibold text-center md:text-start text-[#2E2929] dark:text-[#E6E6E6]">
{highlightTitle(ecosystemTitle, wordsToHighlightForEcosystem, highlightColor)}
{highlightTitle(
ecosystemTitle,
phrasesToHighlightForEcosystemChinese,
phrasesToHighlightForEcosystemEnglish,
highlightColor,
)}
</h2>
<p className="mt-4 text-[#737B7D] dark:text-[#81888A] text-center md:text-start">
{ecosystemContent}
{/*{ecosystemContent}*/}
</p>
</div>
<div className="flex items-center justify-center w-full mt-2">
<div className="grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4 justify-items-center">
{ecosystemBrand.map((brand) => (
<button className="relative bg-white dark:bg-inherit rounded-full md:rounded-lg p-4 flex flex-row md:flex-col items-center md:justify-center justify-start border border-1 border-b-[6px] border-black dark:border-white active:border-b-4 active:transform active:translate-y-0.5 transition-all shadow-sm w-full h-14 md:w-52 md:h-32 gap-2 hover:cursor-pointer hover:shadow-md">
<button className="relative bg-white dark:bg-inherit rounded-full md:rounded-lg p-4 flex flex-row md:flex-col items-center md:justify-center justify-start border border-1 border-b-[6px] border-black dark:border-white active:border-b-4 active:transform active:translate-y-0.5 transition-all shadow-sm w-full h-14 md:w-52 md:h-32 gap-2 hover:cursor-default hover:shadow-md">
<Image
src={brand.brandLogo}
alt={brand.brandTitle}
Expand All @@ -291,19 +330,22 @@ const Index = ({
<div className="py-16 md:py-20 px-4 sm:px-6 md:px-8 lg:px-20 bg-white dark:bg-inherit flex flex-col md:flex-row items-center justify-center gap-6 md:gap-8">
<div className="px-4 w-full h-full">
<h2 className="text-4xl md:text-6xl font-semibold text-center md:text-start text-[#2E2929] dark:text-[#E9E9E9]">
{highlightTitle(blogsTitle, wordsToHighlightForBlogs, highlightColor)}
{highlightTitle(
blogsTitle,
phrasesToHighlightForBlogsChinese,
phrasesToHighlightForBlogsEnglish,
highlightColor,
)}
</h2>
<div className="mt-8 flex flex-col gap-8">
{blogs?.map((blog) => (
<Link key={blog.title} href={blog.link} className="block">
<div className="bg-inherit md:bg-white dark:bg-[#333] shadow-xl md:shadow-md hover:shadow-xl rounded-lg md:border border-gray-200 dark:border-[#333] transition-all duration-300 flex flex-col md:flex-row overflow-hidden">
<div className="bg-inherit md:bg-white dark:bg-[#333] shadow-md hover:shadow-lg dark:hover:border-[#555] rounded-lg md:border border-gray-200 dark:border-[#333] transition-all duration-300 flex flex-col md:flex-row overflow-hidden">
<div className="md:w-1/3 w-full h-auto">
<Image
<img
src={blog.image}
alt={blog.title}
height={501}
width={236}
className="h-full w-full object-cover md:rounded-lg dark:scale-105"
className="h-[200px] w-full object-fill rounded-lg"
/>
</div>
<div className="flex flex-col p-6 md:p-8 w-full justify-between">
Expand Down
Loading
Loading