-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Astro website migrate all components to astro components (#4710)
progress for #2564 - Get rid of fluent ui jsx apart from the playground as it cannot be SSr with astro - Use pure astro components for everything which force them to be fully rendered on the UI
- Loading branch information
1 parent
8ba6830
commit 524fa9e
Showing
111 changed files
with
3,160 additions
and
2,583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// @ts-check | ||
import { addClassName } from "@expressive-code/core/hast"; | ||
import { defineEcConfig } from "astro-expressive-code"; | ||
import tspTryitCode from "./src/plugins/tsp-tryit-code.js"; | ||
|
||
const base = process.env.TYPESPEC_WEBSITE_BASE_PATH ?? "/"; | ||
|
||
export default defineEcConfig({ | ||
themeCssSelector: (theme, { styleVariants }) => { | ||
// If one dark and one light theme are available, and the user has not disabled it, | ||
// generate theme CSS selectors compatible with Starlight's dark mode switch | ||
const baseTheme = styleVariants[0]?.theme; | ||
const altTheme = styleVariants.find((v) => v.theme.type !== baseTheme?.type)?.theme; | ||
if (theme === baseTheme || theme === altTheme) return `[data-theme='${theme.type}']`; | ||
// Return the default selector | ||
return `[data-theme='${theme.name}']`; | ||
}, | ||
styleOverrides: { | ||
// Starlight theme overrides | ||
borderRadius: "0px", | ||
borderWidth: "1px", | ||
codePaddingBlock: "0.75rem", | ||
codePaddingInline: "1rem", | ||
codeFontFamily: "var(--__sl-font-mono)", | ||
codeFontSize: "var(--sl-text-code)", | ||
codeLineHeight: "var(--sl-line-height)", | ||
uiFontFamily: "var(--__sl-font)", | ||
textMarkers: { | ||
lineDiffIndicatorMarginLeft: "0.25rem", | ||
defaultChroma: "45", | ||
backgroundOpacity: "60%", | ||
}, | ||
frames: { | ||
frameBoxShadowCssValue: "none", | ||
}, | ||
}, | ||
plugins: [ | ||
{ | ||
name: "Starlight Plugin", | ||
hooks: { | ||
postprocessRenderedBlock: ({ renderData }) => { | ||
addClassName(renderData.blockAst, "not-content"); | ||
}, | ||
}, | ||
}, | ||
// @ts-expect-error type version mismatch | ||
tspTryitCode(base + "playground/"), | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
/** | ||
* Component for rendering an image resolving the relative path. | ||
*/ | ||
import { baseUrl } from "@site/src/utils"; | ||
import type { HTMLAttributes } from "astro/types"; | ||
export interface AssetImgProps extends HTMLAttributes<"img"> { | ||
src: string; | ||
} | ||
const { src, alt, ...rest } = Astro.props; | ||
--- | ||
|
||
<img class="img" src={baseUrl(`/img/${src}`)} alt={alt ?? ""} {...rest} /> | ||
|
||
<style> | ||
.img { | ||
display: block; | ||
} | ||
</style> |
3 changes: 0 additions & 3 deletions
3
packages/website-astro/src/components/asset-img/asset-img.module.css
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
packages/website-astro/src/components/asset-img/asset-img.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
import Link from "./link.astro"; | ||
export interface Props { | ||
appearance?: "primary" | "outline"; | ||
as?: "a"; | ||
href: string; | ||
className?: string; | ||
} | ||
const { href, className, appearance } = Astro.props; | ||
const appearanceCls = `appearance-${appearance ?? "primary"}`; | ||
--- | ||
|
||
<style> | ||
.button { | ||
align-items: center; | ||
box-sizing: border-box; | ||
display: inline-flex; | ||
justify-content: center; | ||
text-decoration-line: none; | ||
vertical-align: middle; | ||
margin: 0px; | ||
overflow: hidden; | ||
background-color: var(--colorNeutralBackground1); | ||
color: var(--colorNeutralForeground1); | ||
border: var(--strokeWidthThin) solid var(--colorNeutralStroke1); | ||
font-family: var(--fontFamilyBase); | ||
outline-style: none; | ||
padding: 5px var(--spacingHorizontalM); | ||
min-width: 96px; | ||
border-radius: var(--borderRadiusMedium); | ||
font-size: var(--fontSizeBase300); | ||
font-weight: var(--fontWeightSemibold); | ||
line-height: var(--lineHeightBase300); | ||
transition-duration: var(--durationFaster); | ||
transition-property: background, border, color; | ||
transition-timing-function: var(--curveEasyEase); | ||
} | ||
|
||
.button:hover { | ||
color: var(--colorNeutralForeground1); | ||
} | ||
|
||
.appearance-primary { | ||
color: var(--colorNeutralForegroundOnBrand); | ||
background-color: var(--colorBrandBackground); | ||
border-color: transparent; | ||
} | ||
|
||
.appearance-primary:hover { | ||
color: var(--colorNeutralForegroundOnBrand); | ||
background-color: var(--colorBrandBackgroundHover); | ||
} | ||
|
||
.appearance-outline { | ||
background-color: transparent; | ||
} | ||
|
||
.appearance-outline:hover { | ||
background-color: var(--colorNeutralBackground1Hover); | ||
border-color: var(--colorNeutralStroke1Hover); | ||
color: var(--colorNeutralForeground1Hover); | ||
} | ||
</style> | ||
<Link class:list={["button", appearanceCls, className]} href={href}> | ||
<slot /> | ||
</Link> |
47 changes: 0 additions & 47 deletions
47
packages/website-astro/src/components/button/button.module.css
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
export interface Props { | ||
/** Should skip padding. */ | ||
noPadding?: boolean; | ||
/** Should the background blend. */ | ||
blend?: boolean; | ||
children?: React.ReactNode; | ||
class?: string; | ||
} | ||
const { class: cls, noPadding, blend } = Astro.props; | ||
--- | ||
|
||
<style> | ||
.card { | ||
border-radius: 22px; | ||
position: relative; | ||
} | ||
|
||
.bg { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 22px; | ||
background-color: var(--colorNeutralBackground1); | ||
} | ||
|
||
.content { | ||
position: relative; | ||
z-index: 100; | ||
padding: 20px; | ||
} | ||
|
||
.no-padding .content { | ||
padding: 0px; | ||
} | ||
|
||
.blend > .bg { | ||
opacity: 0.2; | ||
} | ||
</style> | ||
|
||
<div class:list={["card", noPadding && "no-padding", blend && "blend", cls]}> | ||
<div class="bg"></div> | ||
<div class="content"><slot /></div> | ||
</div> |
26 changes: 0 additions & 26 deletions
26
packages/website-astro/src/components/card/card.module.css
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
packages/website-astro/src/components/docusaurus/core/BrowserOnly.ts
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/website-astro/src/components/docusaurus/core/Link.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.