Skip to content

Commit 12fa748

Browse files
committed
docs(example): Ensure default is set in example site
1 parent 7edddcc commit 12fa748

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

example/components/TransitionSelect.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@ import * as React from 'react';
22
import { ModalTransition } from '../../dist';
33

44
interface Props {
5+
value: ModalTransition;
56
onChange(transition: ModalTransition);
67
}
7-
export const TransitionSelect: React.FC<Props> = ({ onChange }) => (
8+
export const TransitionSelect: React.FC<Props> = ({ value, onChange }) => (
89
<div className="w-full md:w-1/4 mb-6 md:mb-0 mt-8">
910
<label className="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2">
1011
Transition
1112
</label>
1213
<div className="relative">
1314
<select
14-
className="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
15+
value={value}
16+
className="block appearance-none w-full border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
1517
onChange={e => onChange(e.target.value as ModalTransition)}
1618
>
17-
{Object.keys(ModalTransition).map(value => (
18-
<option key={value} value={value}>
19-
{value}
19+
{Object.keys(ModalTransition).map(option => (
20+
<option key={option} value={option}>
21+
{option}
2022
</option>
2123
))}
2224
</select>

example/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ const Component = ({ transition }) => {
9191
};
9292

9393
const App = () => {
94-
const [transition, setTransition] = React.useState(ModalTransition.NONE);
94+
const [transition, setTransition] = React.useState(ModalTransition.SCALE);
9595

9696
return (
9797
<ModalProvider>
9898
<div className="p-8">
9999
<Component transition={transition} />
100-
<TransitionSelect onChange={setTransition} />
100+
<TransitionSelect value={transition} onChange={setTransition} />
101101
</div>
102102
</ModalProvider>
103103
);

0 commit comments

Comments
 (0)