Skip to content

Commit

Permalink
Imrpove home page and slogan (#2940)
Browse files Browse the repository at this point in the history
* Redo home page

* formatting

* write translations

* responsive layout

* Update features & tagline

* fmt

* no safe
  • Loading branch information
ranile authored Nov 4, 2022
1 parent da09755 commit 374e5f1
Show file tree
Hide file tree
Showing 9 changed files with 664 additions and 2,597 deletions.
3 changes: 2 additions & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const editUrl = 'https://github.com/yewstack/yew/blob/master/website/'
module.exports = {
title: 'Yew',
tagline:
'Yew is a modern Rust framework for creating multi-threaded front-end web apps with WebAssembly.',
'A framework for creating reliable and efficient web applications.',
url: 'https://yew.rs',
baseUrl: '/',
onBrokenLinks: 'throw',
Expand Down Expand Up @@ -130,6 +130,7 @@ module.exports = {
},
plugins: [
'content-pages',
'docusaurus-plugin-sass',
[
'@docusaurus/theme-classic',
{
Expand Down
4 changes: 4 additions & 0 deletions website/i18n/ja/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,9 @@
"theme.admonition.caution": {
"message": "caution",
"description": "The default label used for the Caution admonition (:::caution)"
},
"theme.tags.tagsPageTitle": {
"message": "タグ",
"description": "The title of the tag list page"
}
}
4 changes: 4 additions & 0 deletions website/i18n/zh-Hans/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,9 @@
"theme.admonition.caution": {
"message": "警告",
"description": "The default label used for the Caution admonition (:::caution)"
},
"theme.tags.tagsPageTitle": {
"message": "标签",
"description": "The title of the tag list page"
}
}
4 changes: 4 additions & 0 deletions website/i18n/zh-Hant/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,9 @@
"theme.admonition.caution": {
"message": "警告",
"description": "The default label used for the Caution admonition (:::caution)"
},
"theme.tags.tagsPageTitle": {
"message": "標籤",
"description": "The title of the tag list page"
}
}
2,958 changes: 449 additions & 2,509 deletions website/package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
"fmt:write": "prettier --write ."
},
"dependencies": {
"@docusaurus/core": "^2.0.0",
"@docusaurus/plugin-client-redirects": "^2.1.0",
"@docusaurus/plugin-content-docs": "^2.0.0",
"@docusaurus/plugin-content-pages": "^2.0.0",
"@docusaurus/plugin-google-analytics": "^2.0.0",
"@docusaurus/core": "~2.1.0",
"@docusaurus/plugin-client-redirects": "~2.1.0",
"@docusaurus/plugin-content-docs": "~2.1.0",
"@docusaurus/plugin-content-pages": "~2.1.0",
"@docusaurus/plugin-google-analytics": "~2.1.0",
"@docusaurus/theme-classic": "^2.1.0",
"@easyops-cn/docusaurus-search-local": "^0.32.0",
"@mdx-js/react": "^1.6.22",
"@svgr/webpack": "^6.2.1",
"clsx": "^1.1.1",
"docusaurus-plugin-sass": "^0.2.2",
"file-loader": "^6.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "^1.55.0",
"url-loader": "^4.1.1"
},
"browserslist": {
Expand Down
82 changes: 0 additions & 82 deletions website/src/pages/index.mdx

This file was deleted.

91 changes: 91 additions & 0 deletions website/src/pages/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
@mixin devices($breakpoint) {
@if $breakpoint == desktop {
@media only screen and (min-width: 700px) {
@content;
}
}

@if $breakpoint == tablet {
@media only screen and (min-width: 700px) {
@content;
}
}

@if $breakpoint == mobile {
@media only screen and (min-width: 350px) {
@content;
}
}
}

.heroHeader {
flex-direction: column;
}

.heroSubtitle {
@include devices(mobile) {
padding: 1rem;
text-align: center;
}
}

.header {
display: flex;
padding: var(--ifm-h1-font-size);
gap: calc(var(--ifm-h1-font-size) / 2);
align-items: center;
justify-content: center;

h1 {
@include devices(desktop) {
--ifm-h1-font-size: calc(var(--ifm-h1-font-size) * 3);
}
@include devices(tablet) {
--ifm-h1-font-size: calc(var(--ifm-h1-font-size) * 1.5);
}
}

img {
$dimensions: calc(var(--ifm-h1-font-size) * 5);

@include devices(tablet) {
$dimensions: calc(var(--ifm-h1-font-size) * 3);
}

width: $dimensions;
height: $dimensions;
}
}

.callToActions {
display: flex;
flex-direction: column;

@include devices(desktop) {
flex-direction: row;
}
}

.features {
h2 {
font-size: calc(var(--ifm-h2-font-size) * 1.5);

@include devices(mobile) {
font-size: calc(var(--ifm-h2-font-size) * 1.5);
}
}

.featuresGrid {
$spacing: 2rem;
padding: $spacing;
display: grid;

grid-template-columns: 1fr;
gap: ($spacing * 2);

@include devices(tablet) {
grid-template-columns: repeat(3, 1fr);
gap: $spacing;
}
}
}
103 changes: 103 additions & 0 deletions website/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React from 'react'
import Layout from '@theme/Layout'
import styles from './index.module.scss'
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
import clsx from 'clsx'
import IconExternalLink from '@theme/Icon/ExternalLink'
import Link from '@docusaurus/Link'

const Hero = () => {
const { siteConfig } = useDocusaurusContext()

return (
<div className={clsx('hero shadow--lw', styles.heroHeader)}>
<section className={styles.header}>
<img src={siteConfig.favicon} alt="Logo" />
<h1 className="hero__title">{siteConfig.title}</h1>
</section>
<section className={clsx('hero__subtitle', styles.heroSubtitle)}>
{siteConfig.tagline}
</section>
<section className={styles.callToActions}>
<Link
className="button button--lg button--outline button--primary margin--lg"
to="/docs/getting-started/introduction"
>
Get Started
</Link>
<Link
className="button button--lg button--outline button--link margin--lg"
to="https://play.yew.rs"
target="_blank"
>
Playground
<IconExternalLink />
</Link>
</section>
</div>
)
}

const FEATURES = [
{
header: 'Component Based',
body: 'Features a component-based framework which makes it easy to create interactive UIs. Developers who have experience with frameworks like React and Elm should feel quite at home when using Yew.',
to: '/docs/next/concepts/function-components',
},
{
header: 'HTML macro',
body: 'Features a macro for declaring interactive HTML with Rust expressions. Developers who have experience using JSX in React should feel quite at home when using Yew.',
to: '/docs/next/concepts/html',
},
{
header: 'Server Side Rendering',
body: 'Features server side rendering for all the SEO and enhancements of server-rendered app while keeping the feel of an SPA',
to: '/docs/next/advanced-topics/server-side-rendering',
},
]

function Feature(props: { feature: typeof FEATURES[number] }) {
return (
<div className="card-demo">
<div className="card">
<div className="card__header">
<h3>{props.feature.header}</h3>
</div>
<div className="card__body">
<p>{props.feature.body}</p>
</div>
<div className="card__footer">
<Link
className="button button--secondary"
to={props.feature.to}
>
Learn more
</Link>
</div>
</div>
</div>
)
}

function Features() {
return (
<article className={clsx('padding--lg', styles.features)}>
<h2>Features</h2>
<section className={styles.featuresGrid}>
{FEATURES.map((it) => (
<Feature feature={it} />
))}
</section>
</article>
)
}

export default function Index() {
const { siteConfig } = useDocusaurusContext()
return (
<Layout description={siteConfig.tagline}>
<Hero />
<Features />
</Layout>
)
}

0 comments on commit 374e5f1

Please sign in to comment.