Skip to content

Commit 0c53ee6

Browse files
committed
Fix snippet options retrieval in playground
1 parent 8bd8185 commit 0c53ee6

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

docs/scripts/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

playground/src/components/AppProvider/AppProvider.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface AppProviderContext {
2424
windowSizes: WindowSizes;
2525
setCode: (code: string) => void;
2626
share: (code: string, options: string) => void;
27+
setOptions: (options: PluginOptions) => void;
2728
setOptionsOpen: React.Dispatch<React.SetStateAction<boolean>>;
2829
changeOptionsMode: (mode: Mode) => void;
2930
changeOptionsSource: (source: Source) => void;
@@ -110,6 +111,7 @@ export const AppProvider = (props: PropsWithChildren<{}>): JSX.Element => {
110111
optionsOpen,
111112
setCode,
112113
share,
114+
setOptions,
113115
setOptionsOpen,
114116
changeOptionsMode,
115117
changeOptionsSource,

playground/src/components/Options/Options.tsx

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { isBoolean } from '@utilities/types';
99
export const Options = (): JSX.Element => {
1010

1111
const {
12+
setOptions,
1213
optionsOpen,
1314
changeOptionsMode,
1415
changeOptionsSource,
@@ -52,36 +53,7 @@ export const Options = (): JSX.Element => {
5253

5354
useEffect(() => {
5455
if (fetchOptions) {
55-
if (fetchOptions.mode) {
56-
changeMode(fetchOptions.mode as string);
57-
}
58-
if (fetchOptions.source) {
59-
changeSource(fetchOptions.source === 'rtl');
60-
}
61-
if (isBoolean(fetchOptions.safeBothPrefix)) {
62-
changeIgnorePrefixedRules(fetchOptions.safeBothPrefix as boolean);
63-
}
64-
if (isBoolean(fetchOptions.ignorePrefixedRules)) {
65-
changeIgnorePrefixedRules(fetchOptions.ignorePrefixedRules as boolean);
66-
}
67-
if (isBoolean(fetchOptions.processUrls)) {
68-
changeProcessUrls(fetchOptions.processUrls as boolean);
69-
}
70-
if (isBoolean(fetchOptions.processKeyFrames)) {
71-
changeProcessKeyframes(fetchOptions.processKeyFrames as boolean);
72-
}
73-
if (isBoolean(fetchOptions.processEnv)) {
74-
changeProcessEnv(fetchOptions.processEnv as boolean);
75-
}
76-
if (isBoolean(fetchOptions.useCalc)) {
77-
changeUseCalc(fetchOptions.useCalc as boolean);
78-
}
79-
if (fetchOptions.autoRename) {
80-
changeAutoRename(fetchOptions.autoRename as string);
81-
}
82-
if (isBoolean(fetchOptions.greedy)) {
83-
changeGreedy(fetchOptions.greedy as boolean);
84-
}
56+
setOptions(fetchOptions);
8557
}
8658
}, [fetchOptions]);
8759

0 commit comments

Comments
 (0)