1
0
mirror of https://github.com/actix/actix-website synced 2025-06-29 16:24:58 +02:00

prettier js/html

This commit is contained in:
Rob Ede
2023-11-01 15:32:44 +00:00
parent 0d0e7f4433
commit ee701e0e23
10 changed files with 122 additions and 117 deletions

View File

@ -1,21 +1,21 @@
import React, { useState, useEffect } from 'react';
import RenderCodeBlock from '@theme/CodeBlock';
import React, { useState, useEffect } from "react";
import RenderCodeBlock from "@theme/CodeBlock";
const CodeBlock = ({ example, file, section, language }) => {
const [code, setCode] = useState('');
const [code, setCode] = useState("");
useEffect(() => {
let isMounted = true;
const path =
file === 'manifest' ? 'Cargo.toml' : `src/${file ?? 'main.rs'}`;
file === "manifest" ? "Cargo.toml" : `src/${file ?? "main.rs"}`;
import(`!!raw-loader!@site/examples/${example}/${path}`)
.then((source) => {
source = source.default.match(
new RegExp(
`(?:\/\/|#) <${section}>\n([\\s\\S]*)(?:\/\/|#) <\/${section}>`
)
`(?:\/\/|#) <${section}>\n([\\s\\S]*)(?:\/\/|#) <\/${section}>`,
),
)[1];
if (isMounted) setCode(source);
@ -28,7 +28,7 @@ const CodeBlock = ({ example, file, section, language }) => {
}, []);
return (
<RenderCodeBlock className={`language-${language ?? 'rust'}`}>
<RenderCodeBlock className={`language-${language ?? "rust"}`}>
{code}
</RenderCodeBlock>
);

View File

@ -20,7 +20,7 @@
--ifm-menu-color-background-active: var(--ifm-color-emphasis-200);
}
html[data-theme='dark'] {
html[data-theme="dark"] {
--background-color-secondary: #0a191c;
--examples-odd-background-color: var(--ifm-hero-background-color);
--logo-filter: brightness(0) invert(1);
@ -47,7 +47,6 @@ html[data-theme='dark'] {
padding: 0 var(--ifm-pre-padding);
}
.navbar__logo {
filter: var(--logo-filter);
}

View File

@ -1,18 +1,18 @@
import clsx from 'clsx';
import React from 'react';
import Link from '@docusaurus/Link';
import Layout from '@theme/Layout';
import CodeBlock from '../components/code_block.js';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import styles from './styles.module.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import clsx from "clsx";
import React from "react";
import Link from "@docusaurus/Link";
import Layout from "@theme/Layout";
import CodeBlock from "../components/code_block.js";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl";
import styles from "./styles.module.scss";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faShieldAlt,
faBatteryFull,
faPuzzlePiece,
faTachometerAlt,
} from '@fortawesome/free-solid-svg-icons';
} from "@fortawesome/free-solid-svg-icons";
const Home = () => {
const context = useDocusaurusContext();
@ -32,7 +32,7 @@ const Home = () => {
const highlights = [
{
icon: faShieldAlt,
title: 'Type Safe',
title: "Type Safe",
description: (
<>
Forget about stringly typed objects, from request to response,
@ -42,24 +42,31 @@ const highlights = [
},
{
icon: faBatteryFull,
title: 'Feature Rich',
title: "Feature Rich",
description: (
<>Actix provides a lot of features out of box. HTTP/2, logging, etc.</>
),
},
{
icon: faPuzzlePiece,
title: 'Extensible',
title: "Extensible",
description: (
<>Easily create your own libraries that any Actix application can use.</>
),
},
{
icon: faTachometerAlt,
title: 'Blazingly Fast',
title: "Blazingly Fast",
description: (
<>
Actix is blazingly fast. Don't take our word for it -- <a href='https://www.techempower.com/benchmarks/#section=data-r21&hw=ph&test=fortune' target='_blank' rel='noopener noreferrer'>see for yourself!</a>
Actix is blazingly fast. Don't take our word for it --{" "}
<a
href="https://www.techempower.com/benchmarks/#section=data-r21&hw=ph&test=fortune"
target="_blank"
rel="noopener noreferrer"
>
see for yourself!
</a>
</>
),
},
@ -70,7 +77,7 @@ const Hero = () => {
const { siteConfig } = context;
return (
<header id="hero" className={clsx('hero', styles.banner)}>
<header id="hero" className={clsx("hero", styles.banner)}>
<div className="container">
<img
src={useBaseUrl(`img/logo.png`)}
@ -79,14 +86,14 @@ const Hero = () => {
/>
<h1 className="hero__title">{siteConfig.title}</h1>
<p className={clsx('hero__subtitle', styles.subtitle)}>
<p className={clsx("hero__subtitle", styles.subtitle)}>
{siteConfig.tagline}
</p>
<div className={styles.buttons}>
<Link
className="button button--primary button--lg"
to={useBaseUrl('docs/')}
to={useBaseUrl("docs/")}
>
Get Started
</Link>
@ -106,7 +113,7 @@ const Highlights = () => {
<div className="row">
{highlights.map((highlight, idx) => (
<div
className={clsx('col col--6', styles.highlight)}
className={clsx("col col--6", styles.highlight)}
key={idx}
>
<div className="item">
@ -137,8 +144,9 @@ const Examples = () => {
<div className={styles.featureText}>
<h3 className={styles.featureTitle}>Hello World!</h3>
<p>
Getting started with Actix is easy. An Actix app comes with a URL routing system that lets you match on
URLs and invoke individual handlers.
Getting started with Actix is easy. An Actix app comes with a URL
routing system that lets you match on URLs and invoke individual
handlers.
</p>
</div>
<div className={styles.example__code}>
@ -169,11 +177,11 @@ const Examples = () => {
<div className={styles.featureText}>
<h3 className={styles.featureTitle}>Powerful Extractors</h3>
<p>
Actix comes with a powerful extractor system that extracts data from
the incoming HTTP request and passes it to your view functions. Not
only does this make for a convenient API but it also means that your
view functions can be synchronous code and still benefit from
asynchronous IO handling.
Actix comes with a powerful extractor system that extracts data
from the incoming HTTP request and passes it to your view
functions. Not only does this make for a convenient API but it
also means that your view functions can be synchronous code and
still benefit from asynchronous IO handling.
</p>
</div>
<div className={styles.example__code}>

View File

@ -3,9 +3,7 @@ module.exports = function (context, options) {
configureWebpack(config, isServer, utils) {
return {
module: {
rules: [
{ test: /\.rs$/, use: 'raw-loader' },
],
rules: [{ test: /\.rs$/, use: "raw-loader" }],
},
};
},