-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve sandbox labels with createSandboxFunctionsWithLabels
- Loading branch information
1 parent
9f83f56
commit 1bbfa5d
Showing
21 changed files
with
185 additions
and
228 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/embla-carousel-docs/src/components/CodeSandbox/createSandboxFunctionsWithLabels.ts
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,26 @@ | ||
import { PropType as CreateCodeSandboxFormPropType } from './CreateCodeSandboxForm' | ||
|
||
export const SANDBOX_CREATE_LABELS = { | ||
reactJs: 'React', | ||
reactTs: 'React+TS', | ||
vanillaJs: 'Vanilla', | ||
vanillaTs: 'Vanilla+TS', | ||
} | ||
|
||
type CreateSandboxesKeyType = keyof typeof SANDBOX_CREATE_LABELS | ||
type CreateSandboxFunctionType = CreateCodeSandboxFormPropType['createSandbox'] | ||
type CreateSandboxesType = { | ||
[key in CreateSandboxesKeyType]: CreateSandboxFunctionType | ||
} | ||
|
||
export const createSandboxFunctionsWithLabels = ( | ||
createSandboxFunction: Partial<CreateSandboxesType>, | ||
): CreateCodeSandboxFormPropType[] => { | ||
return Object.keys(createSandboxFunction).map((sandboxLabelKey) => { | ||
const key = <CreateSandboxesKeyType>sandboxLabelKey | ||
const createSandbox = <CreateSandboxFunctionType>createSandboxFunction[key] | ||
const label = SANDBOX_CREATE_LABELS[key] | ||
|
||
return { label, createSandbox } | ||
}) | ||
} |
16 changes: 0 additions & 16 deletions
16
packages/embla-carousel-docs/src/components/CodeSandbox/sandboxLabels.ts
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
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
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
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
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
Oops, something went wrong.