Skip to content

Commit

Permalink
more type fixes in playground
Browse files Browse the repository at this point in the history
  • Loading branch information
zxbodya committed Nov 10, 2023
1 parent f492d6d commit c846f0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/playground/src/components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface PlaygroundProps {
export default function Playground({ themes, validators }: PlaygroundProps) {
const [loaded, setLoaded] = useState(false);
const [schema, setSchema] = useState<RJSFSchema>(samples.Simple.schema as RJSFSchema);
const [uiSchema, setUiSchema] = useState<UiSchema>(samples.Simple.uiSchema);
const [uiSchema, setUiSchema] = useState<UiSchema>(samples.Simple.uiSchema!);
const [formData, setFormData] = useState<any>(samples.Simple.formData);
const [extraErrors, setExtraErrors] = useState<ErrorSchema | undefined>();
const [shareURL, setShareURL] = useState<string | null>(null);
Expand Down
8 changes: 4 additions & 4 deletions packages/playground/src/components/Selector.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useState, MouseEvent } from 'react';
import { Sample, samples } from '../samples';
import { samples } from '../samples';

interface SelectorProps {
onSelected: (data: any) => void;
}

export default function Selector({ onSelected }: SelectorProps) {
const [current, setCurrent] = useState<Sample>('Simple');
const [current, setCurrent] = useState<string>('Simple');

function onLabelClick(label: Sample) {
function onLabelClick(label: string) {
return (event: MouseEvent) => {
event.preventDefault();
setCurrent(label);
Expand All @@ -21,7 +21,7 @@ export default function Selector({ onSelected }: SelectorProps) {
{Object.keys(samples).map((label, i) => {
return (
<li key={i} role='presentation' className={current === label ? 'active' : ''}>
<a href='#' onClick={onLabelClick(label as Sample)}>
<a href='#' onClick={onLabelClick(label)}>
{label}
</a>
</li>
Expand Down

0 comments on commit c846f0e

Please sign in to comment.