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: Start populating some content #2539

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"editor.detectIndentation": false,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json][[jsonc][yaml][typespec][markdown]": {
"[json][[jsonc][yaml][typespec][markdown][css]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.insertSpaces": true,
Expand Down
29 changes: 22 additions & 7 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ words:
- openapi
- openapiv
- picocolors
- prismjs
- proto
- protobuf
- protoc
Expand Down
5 changes: 2 additions & 3 deletions docs/extending-typespec/emitters-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ A TypeSpec emitter exports a function named `$onEmit` from its main entrypoint.
For example, the following will write a text file to the output directory:

```typescript
import { EmitContext } from "@typespec/compiler";
import Path from "path";
import { EmitContext, resolvePath } from "@typespec/compiler";

export async function $onEmit(context: EmitContext) {
const outputDir = Path.join(context.emitterOutputDir, "hello.txt");
const outputDir = resolvePath(context.emitterOutputDir, "hello.txt");
await context.program.host.writeFile(outputDir, "hello world!");
}
```
Expand Down
4 changes: 4 additions & 0 deletions packages/website/definitions/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
declare module "*.png";
declare module "!!raw-loader!@site/static/*" {
const contents: string;
export = contents;
}
12 changes: 5 additions & 7 deletions packages/website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

// const lightCodeTheme = require("prism-react-renderer/themes/github");
const lightCodeTheme = require("./themes/prism/atom-one-light.js");
const { themes } = require("prism-react-renderer");
const { resolve } = require("path");

Expand Down Expand Up @@ -124,8 +122,8 @@ const config = {
to: "/openapi",
},
{
label: "JSON RPC",
to: "/json-rpc",
label: "JSON Schema",
to: "/json-schema",
},
{
label: "Data validation and type consistency",
Expand Down Expand Up @@ -193,9 +191,9 @@ const config = {
copyright: `Copyright © ${new Date().getFullYear()} Microsoft Corp.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: themes.dracula,
additionalLanguages: [],
theme: themes.oneLight,
darkTheme: themes.oneDark,
additionalLanguages: ["shell-session"],
},
mermaid: {},
algolia: {
Expand Down
6 changes: 4 additions & 2 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@docusaurus/theme-mermaid": "^2.4.3",
"@docusaurus/theme-common": "~2.4.3",
"@mdx-js/react": "^1.6.22",
"prism-react-renderer": "^2.0.6",
"prism-react-renderer": "^2.1.0",
"prismjs": "~1.29.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"@fluentui/react-components": "~9.32.1"
Expand Down Expand Up @@ -58,7 +59,8 @@
"eslint": "^8.49.0",
"rimraf": "~5.0.1",
"dotenv": "~16.3.1",
"swc-loader": "^0.2.3"
"swc-loader": "^0.2.3",
"raw-loader": "~4.0.2"
},
"browserslist": {
"production": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.img {
display: block;
}
15 changes: 15 additions & 0 deletions packages/website/src/components/asset-img/asset-img.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import useBaseUrl from "@docusaurus/useBaseUrl";
import style from "./asset-img.module.css";

export interface AssetImgProps {
src: string;
className?: string;
}

/**
* Component for rendering an image resolving the relative path.
*/
export const AssetImg = ({ src, ...props }: AssetImgProps) => {
const fullSrc = useBaseUrl(`/img/${src}`);
return <img className={style["img"]} src={fullSrc} {...props} />;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.code-block {
margin: 0;
}
7 changes: 7 additions & 0 deletions packages/website/src/components/code-block/code-block.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import CodeBlockDocusaurus, { Props } from "@theme/CodeBlock";
import style from "./code-block.module.css";

export interface CodeBlockProps extends Props {}
export const CodeBlock = (props: CodeBlockProps) => {
return <CodeBlockDocusaurus {...props} className={style["code-block"]} />;
};
9 changes: 7 additions & 2 deletions packages/website/src/components/fluent-img.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ export interface FluentImgProps {
}

export type FluentImageName =
| "checkmark"
| "chat"
| "checkmark"
| "design-layout"
| "design"
| "document-add"
| "document-cloud"
| "editor"
| "eye-dev"
| "firework"
| "people-shield";
| "people-shield"
| "shield-blue"
| "shield-settings";

/**
* Component for rendering a Fluent image.
Expand Down
9 changes: 6 additions & 3 deletions packages/website/src/components/homepage/homepage.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.intro-container {
background-repeat: no-repeat;
width: 100vw;
width: 100%;
background-size: 100vw 94%;

display: flex;
Expand Down Expand Up @@ -94,8 +94,11 @@
display: flex;
padding: 80px 60px;
flex-direction: column;
align-items: flex-start;
align-items: center;
gap: 16px;
flex: 1 0 0;
margin: auto;
}

.codeblock-seperator {
height: 10px;
}
Loading