Skip to content

Commit

Permalink
update websites
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Feb 1, 2022
1 parent dc448df commit 23c1083
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 26 deletions.
1 change: 0 additions & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: "Chromatic"

on:
push:
types: [review_requested, ready_for_review]
paths:
- "sandpack-react/src/**"

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Deploy Documentation
on:
push:
types: [review_requested, ready_for_review]
paths:
- "sandpack-client/**"
- "sandpack-react/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-landing.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Deploy Landing page
on:
push:
types: [review_requested, ready_for_review]
paths:
- "sandpack-client/**"
- "sandpack-react/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-theme.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Deploy Theme Builder
on:
push:
types: [review_requested, ready_for_review]
paths:
- "sandpack-client/**"
- "sandpack-react/**"
Expand Down
21 changes: 8 additions & 13 deletions sandpack-react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import type {

import type { CodeEditorProps } from ".";

interface SandpackRootProps {
files?: SandpackFiles;
template?: SandpackPredefinedTemplate;
customSetup?: SandpackSetup;
}

export interface SandpackOptions {
/**
* List the file path listed in the file tab,
Expand Down Expand Up @@ -41,13 +47,8 @@ export interface SandpackOptions {
externalResources?: string[];
}

interface SandpackRootProps {
files?: SandpackFiles;
template?: SandpackPredefinedTemplate;
customSetup?: SandpackSetup;
}

interface SandpackPresetOptions {
export interface SandpackProps extends SandpackRootProps {
theme?: SandpackThemeProp;
options?: SandpackOptions & {
editorWidthPercentage?: number;
editorHeight?: React.CSSProperties["height"];
Expand Down Expand Up @@ -75,12 +76,6 @@ interface SandpackPresetOptions {
};
}

export interface SandpackProps
extends SandpackRootProps,
SandpackPresetOptions {
theme?: SandpackThemeProp;
}

export interface SandpackProviderProps extends SandpackRootProps {
options?: SandpackOptions;
}
Expand Down
12 changes: 7 additions & 5 deletions sandpack-react/src/utils/sandpackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ import { addPackageJSONIfNeeded } from "@codesandbox/sandpack-client";

import { SANDBOX_TEMPLATES } from "../templates";
import type {
SandpackProviderState,
SandboxTemplate,
SandpackPredefinedTemplate,
SandpackProviderProps,
SandpackSetup,
SandpackFiles,
SandboxEnvironment,
} from "../types";

type SandpackContextInfo = Pick<
SandpackProviderState,
"activePath" | "openPaths" | "files" | "environment"
>;
export interface SandpackContextInfo {
activePath: string;
openPaths: string[];
files: Record<string, SandpackBundlerFile>;
environment: SandboxEnvironment;
}

export const getSandpackStateFromProps = (
props: SandpackProviderProps
Expand Down
6 changes: 3 additions & 3 deletions website/landing/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export const Hero: React.FC = () => {
<SandpackProvider
customSetup={{
dependencies: { "@stitches/react": "latest" },
entry: "./index.js",
files,
entry: "/index.js",
}}
initMode="immediate"
files={files}
options={{ initMode: "immediate" }}
template="react"
>
<HeroDesktop />{" "}
Expand Down
4 changes: 2 additions & 2 deletions website/landing/components/Intro/Examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ export const Examples: React.FC = () => {
>
<SandpackProvider
customSetup={{
files: layoutFiles,
dependencies: { "@codesandbox/sandpack-react": "latest" },
}}
initMode="user-visible"
files={layoutFiles}
options={{ initMode: "user-visible" }}
template="react"
>
<ClasserProvider
Expand Down
2 changes: 1 addition & 1 deletion website/landing/components/Intro/Sections/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export const LayoutExample: React.FC = () => {
<Caption>Sandpack preview</Caption>
<SandpackProvider
customSetup={{
files: layoutFiles,
dependencies: { "@codesandbox/sandpack-react": "latest" },
}}
files={layoutFiles}
template="react"
>
<ClasserProvider
Expand Down
2 changes: 1 addition & 1 deletion website/landing/components/common/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const CodeBlock: React.FC = ({ children }) => {
}}
>
<SandpackProvider
files={{ "index.ts": (children as string)?.trim() }}
customSetup={{ entry: "index.ts" }}
files={{ "index.ts": (children as string)?.trim() }}
options={{ initMode: "immediate" }}
>
<SandpackThemeProvider theme="sandpack-dark">
Expand Down

0 comments on commit 23c1083

Please sign in to comment.