Skip to content

Commit ef1d117

Browse files
committed
Adds a rough layout to the site
1 parent cd073dd commit ef1d117

File tree

10 files changed

+227
-80
lines changed

10 files changed

+227
-80
lines changed

.vscode/settings.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"files.exclude": {
33
"**/.rts2_cache*": true
4-
}
5-
}
4+
},
5+
"workbench.colorCustomizations": {
6+
"activityBar.background": "#3178C6",
7+
"activityBar.foreground": "#000000",
8+
"activityBar.inactiveForeground": "#15202b99",
9+
"activityBarBadge.background": "#ffffff",
10+
"activityBarBadge.foreground": "#15202b"
11+
},
12+
"peacock.color": "#3178C6",
13+
}

packages/typescriptlang-org/gatsby-config.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
// https://github.com/gatsbyjs/gatsby/issues/1457
2-
require('ts-node').register({ files: true })
2+
require("ts-node").register({ files: true })
33

44
module.exports = {
55
plugins: [
6+
// Creates TS types for queries during `gatsby dev`
67
"gatsby-plugin-codegen",
7-
`gatsby-plugin-typescript`,
8+
// Support ts/tsx files in src
9+
"gatsby-plugin-typescript",
10+
11+
// Let's you edit the head from inside a react tree
12+
"gatsby-plugin-react-helmet",
13+
14+
// Grabs the old handbook markdown files
815
{
916
resolve: `gatsby-source-filesystem`,
1017
options: {
1118
path: `${__dirname}/../handbook-v1/en`,
1219
name: `handbook-v1`,
1320
},
1421
},
22+
// Grabs file from the tsconfig reference
1523
{
1624
resolve: `gatsby-source-filesystem`,
1725
options: {
1826
path: `${__dirname}/../tsconfig-reference/output`,
1927
name: `tsconfig-reference`,
2028
},
2129
},
30+
// Markdown support
2231
{
2332
resolve: `gatsby-transformer-remark`,
2433
options: {

packages/typescriptlang-org/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
"serve": "gatsby serve"
1313
},
1414
"dependencies": {
15+
"@types/react-helmet": "^5.0.14",
1516
"@uifabric/fluent-theme": "^7.1.4",
1617
"@uifabric/react-cards": "^0.108.2",
1718
"gatsby": "^2.15.29",
1819
"gatsby-plugin-codegen": "^1.0.4",
20+
"gatsby-plugin-react-helmet": "^3.1.13",
1921
"gatsby-plugin-sharp": "^2.2.28",
2022
"gatsby-remark-copy-linked-files": "^2.1.24",
2123
"gatsby-remark-images": "^3.1.25",
@@ -28,6 +30,7 @@
2830
"prismjs": "^1.17.1",
2931
"react": "^16.10.2",
3032
"react-dom": "^16.10.2",
33+
"react-helmet": "^5.2.1",
3134
"ts-node": "^8.4.1"
3235
},
3336
"devDependencies": {
Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,18 @@
11
import React from "react"
22
import { Link } from "gatsby"
3+
import { SiteNav } from "./layout/TopNav"
34

45

56
declare const __PATH_PREFIX__: string
67

78
export class Layout extends React.Component<any> {
89
render() {
9-
const { location, title, children } = this.props
10-
const rootPath = `${__PATH_PREFIX__}/`
11-
let header
12-
13-
header = (
14-
<h3
15-
style={{
16-
fontFamily: `Montserrat, sans-serif`,
17-
marginTop: 0,
18-
}}
19-
>
20-
<Link
21-
style={{
22-
boxShadow: `none`,
23-
textDecoration: `none`,
24-
color: `inherit`,
25-
}}
26-
to={`/`}
27-
>
28-
{title}
29-
</Link>
30-
</h3>
31-
)
32-
10+
const { children } = this.props
3311
return (
34-
<div
35-
style={{
36-
backgroundColor: "#E5E5E5",
37-
marginLeft: `auto`,
38-
marginRight: `auto`,
39-
}}
40-
>
41-
<header>{header}</header>
12+
<div>
13+
<SiteNav />
4214
<main>{children}</main>
43-
<footer>
44-
<a href="/deprecated">Old stuff</a>
45-
© {new Date().getFullYear()}, Built with
46-
{` `}
47-
<a href="https://www.gatsbyjs.org">Gatsby</a>
48-
</footer>
49-
</div >
15+
</div>
5016
)
5117
}
5218
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, { CSSProperties } from "react"
2+
import { Text, FontWeights } from "office-ui-fabric-react"
3+
import { Helmet } from "react-helmet";
4+
import { Link } from "gatsby"
5+
import { palette } from "../../lib/theme"
6+
import { IComponentStyles } from "office-ui-fabric-react/lib/Foundation";
7+
8+
export type Props = {
9+
centeredLayout?: boolean
10+
}
11+
12+
const boldStyle: IComponentStyles<any> = { root:
13+
{ fontWeight: FontWeights.semibold, color: "white", textDecoration: "none" }
14+
}
15+
16+
export class SiteNav extends React.Component<Props> {
17+
render() {
18+
const { children } = this.props
19+
20+
return (
21+
<header dir="ltr">
22+
<Helmet>
23+
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/10.0.0/css/fabric.min.css" />
24+
</Helmet>
25+
26+
<div id="top-menu">
27+
<div className="left">
28+
<a href="/" aria-label="TypeScript Home Page" style={{ textDecoration: "none" }}>
29+
<svg style={{ marginLeft: "1rem", marginTop: "0.55rem", marginRight: "1rem" }} fill="none" height="26" viewBox="0 0 27 26" width="27" xmlns="http://www.w3.org/2000/svg"><path clipRule="evenodd" d="m.98608 0h24.32332c.5446 0 .9861.436522.9861.975v24.05c0 .5385-.4415.975-.9861.975h-24.32332c-.544597 0-.98608-.4365-.98608-.975v-24.05c0-.538478.441483-.975.98608-.975zm13.63142 13.8324v-2.1324h-9.35841v2.1324h3.34111v9.4946h2.6598v-9.4946zm1.0604 9.2439c.4289.2162.9362.3784 1.5218.4865.5857.1081 1.2029.1622 1.8518.1622.6324 0 1.2331-.0595 1.8023-.1784.5691-.1189 1.0681-.3149 1.497-.5879s.7685-.6297 1.0187-1.0703.3753-.9852.3753-1.6339c0-.4703-.0715-.8824-.2145-1.2365-.1429-.3541-.3491-.669-.6186-.9447-.2694-.2757-.5925-.523-.9692-.7419s-.8014-.4257-1.2743-.6203c-.3465-.1406-.6572-.2771-.9321-.4095-.275-.1324-.5087-.2676-.7011-.4054-.1925-.1379-.3409-.2838-.4454-.4379-.1045-.154-.1567-.3284-.1567-.523 0-.1784.0467-.3392.1402-.4824.0935-.1433.2254-.2663.3959-.369s.3794-.1824.6269-.2392c.2474-.0567.5224-.0851.8248-.0851.22 0 .4523.0162.697.0486.2447.0325.4908.0825.7382.15.2475.0676.4881.1527.7218.2555.2337.1027.4495.2216.6475.3567v-2.4244c-.4015-.1514-.84-.2636-1.3157-.3365-.4756-.073-1.0214-.1095-1.6373-.1095-.6268 0-1.2207.0662-1.7816.1987-.5609.1324-1.0544.3392-1.4806.6203s-.763.6392-1.0104 1.0743c-.2475.4352-.3712.9555-.3712 1.5609 0 .7731.2268 1.4326.6805 1.9785.4537.546 1.1424 1.0082 2.0662 1.3866.363.146.7011.2892 1.0146.4298.3134.1405.5842.2865.8124.4378.2282.1514.4083.3162.5403.4946s.198.3811.198.6082c0 .1676-.0413.323-.1238.4662-.0825.1433-.2076.2676-.3753.373s-.3766.1879-.6268.2473c-.2502.0595-.5431.0892-.8785.0892-.5719 0-1.1383-.0986-1.6992-.2959-.5608-.1973-1.0805-.4933-1.5589-.8879z" fill="#fff" fillRule="evenodd" /></svg>
30+
<Text variant="xLarge" styles={boldStyle}>TypeScript</Text>
31+
</a>
32+
33+
<nav>
34+
<ul style={{ padding: "0", margin: 0 }}>
35+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white" }} to="/docs">Documentation</Link></li>
36+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white" }} to="/index.html#download-links">Download</Link></li>
37+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white" }} to="/community">Connect</Link></li>
38+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white" }} to="/play">Playground</Link></li>
39+
</ul>
40+
</nav>
41+
</div>
42+
<div className="right">
43+
<nav >
44+
<ul style={{ padding: "0", margin: 0 }}>
45+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white" }} to="/index.html#download-links">SEARCH</Link></li>
46+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white" }} to="/community"><svg fill="none" height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" fill="#fff" r="6"/></svg></Link></li>
47+
<li className="nav-item"><Link style={{ textDecoration: "none", color: "white", fontSize: "1rem" }} to="/play">en</Link></li>
48+
</ul>
49+
</nav>
50+
</div>
51+
</div>
52+
</header>
53+
)
54+
}
55+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { loadTheme } from 'office-ui-fabric-react';
2+
3+
// https://fabricweb.z5.web.core.windows.net/pr-deploy-site/refs/heads/master/theming-designer/index.html
4+
5+
export const palette = {
6+
themePrimary: '#3178c6',
7+
themeLighterAlt: '#f5f9fd',
8+
themeLighter: '#d9e7f6',
9+
themeLight: '#b9d2ee',
10+
themeTertiary: '#7aaadd',
11+
themeSecondary: '#4688ce',
12+
themeDarkAlt: '#2d6eb3',
13+
themeDark: '#265d97',
14+
themeDarker: '#1c446f',
15+
neutralLighterAlt: '#f8f8f8',
16+
neutralLighter: '#f4f4f4',
17+
neutralLight: '#eaeaea',
18+
neutralQuaternaryAlt: '#dadada',
19+
neutralQuaternary: '#d0d0d0',
20+
neutralTertiaryAlt: '#c8c8c8',
21+
neutralTertiary: '#7da5be',
22+
neutralSecondary: '#5d8ca9',
23+
neutralPrimaryAlt: '#417494',
24+
neutralPrimary: '#00273f',
25+
neutralDark: '#174a6a',
26+
black: '#093855',
27+
white: '#ffffff',
28+
} as const
29+
30+
loadTheme({
31+
palette
32+
});
Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,61 @@
1-
.App {
2-
text-align: center;
1+
html {
2+
background-color: #FAF9F8;
33
}
44

5-
.App-logo {
6-
animation: App-logo-spin infinite 20s linear;
7-
height: 40vmin;
8-
pointer-events: none;
5+
body {
6+
margin: 0;
7+
-webkit-font-smoothing: antialiased;
8+
color: #333;
9+
font-family: "Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
10+
font-size: 14px;
911
}
1012

11-
.App-header {
12-
background-color: #282c34;
13-
min-height: 100vh;
13+
body,
14+
html,
15+
#___gatsby {
16+
height: 100%;
17+
}
18+
19+
/*
20+
There isn't a collapsible nav bar in the fabric components, and it is unwieldy to
21+
set up something like that on a styles basis, so it's in the CSS.
22+
*/
23+
24+
#top-menu {
25+
background-color: #3178c6;
26+
user-select: none;
27+
clear: both;
1428
display: flex;
15-
flex-direction: column;
16-
align-items: center;
17-
justify-content: center;
18-
font-size: calc(10px + 2vmin);
19-
color: white;
29+
justify-content: space-between;
2030
}
2131

22-
html {
23-
background-color: #E5E5E5;
32+
#top-menu > .left {
33+
display: flex;
34+
flex-direction: row;
2435
}
2536

26-
body,
27-
html,
28-
#___gatsby {
29-
height: 100%;
37+
#top-menu > .right {
38+
display: flex;
39+
flex-direction: row-reverse;
40+
justify-self: flex-end;
41+
}
42+
43+
#top-menu .nav {
44+
display: inline-block;
45+
text-decoration: none;
46+
}
47+
48+
#top-menu .nav-item {
49+
border: 1px solid transparent;
50+
color: #262626;
51+
display: inline-block;
52+
margin-top: 1px;
53+
padding: 0.8rem 0.5em 0;
54+
height: 45px;
55+
font-size: 1rem;
56+
text-decoration: none;
57+
}
58+
59+
.clear-fix {
60+
clear: both;
3061
}

packages/typescriptlang-org/src/templates/handbook.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
// @ts-check
21
import React from "react"
32
import { Link, graphql } from "gatsby"
4-
import {BlogPostBySlug} from "./__generated__/BlogPostBySlug"
5-
// import Bio from "../components/bio"
6-
import {Layout} from "../components/layout"
7-
// import SEO from "../components/seo"
8-
// import { rhythm, scale } from "../utils/typography"
3+
import { BlogPostBySlug } from "./__generated__/BlogPostBySlug"
4+
import { Layout } from "../components/layout"
95

10-
class BlogPostTemplate extends React.Component<{ pageContext: any, data: BlogPostBySlug}> {
6+
class BlogPostTemplate extends React.Component<{ pageContext: any, data: BlogPostBySlug }> {
117
render() {
128
const post = this.props.data.markdownRemark
139
if (!post) {
@@ -18,9 +14,10 @@ class BlogPostTemplate extends React.Component<{ pageContext: any, data: BlogPo
1814
const { previous, next } = this.props.pageContext
1915
return (
2016
<Layout >
21-
22-
<div dangerouslySetInnerHTML={{ __html: post.html }} />
23-
<hr/>
17+
<div className="ms-depth-4" style={{ backgroundColor: "white", maxWidth: 960, margin: "1rem auto", padding: "2rem" }}>
18+
<div dangerouslySetInnerHTML={{ __html: post.html }} />
19+
</div>
20+
<hr />
2421
<ul>
2522
<li>
2623
{previous && (

packages/typescriptlang-org/src/templates/tsconfigReference.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from "react"
22
import { graphql } from "gatsby"
3-
import {TSConfigReferenceTemplate} from "./__generated__/TSConfigReferenceTemplate"
4-
import {Layout} from "../components/layout"
3+
import { TSConfigReferenceTemplate } from "./__generated__/TSConfigReferenceTemplate"
4+
import { Layout } from "../components/layout"
55

6-
class TSConfigReferenceTemplateComponent extends React.Component<{ pageContext: any, data: TSConfigReferenceTemplate}> {
6+
class TSConfigReferenceTemplateComponent extends React.Component<{ pageContext: any, data: TSConfigReferenceTemplate }> {
77
render() {
88
console.log(this.props)
99
const post = this.props.data.markdownRemark
@@ -15,9 +15,12 @@ class TSConfigReferenceTemplateComponent extends React.Component<{ pageContext:
1515
return (
1616
<Layout >
1717

18+
<div className="ms-depth-4" style={{ backgroundColor: "white", maxWidth: 960, margin: "1rem auto", padding: "2rem" }}>
19+
<h1>TSConfig Reference</h1>
1820
<div dangerouslySetInnerHTML={{ __html: post.html }} />
19-
<hr/>
20-
21+
</div>
22+
<hr />
23+
2124
</Layout>
2225
)
2326
}

0 commit comments

Comments
 (0)