Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions packages/@react-aria/button/stories/useButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

import {AriaButtonProps} from '@react-types/button';
import React, {useRef} from 'react';
import {storiesOf} from '@storybook/react';
import {useButton} from '../';

storiesOf('useButton', module)
.add(
'input type button',
() => <InputButton />
);

interface InputButtonProps extends AriaButtonProps<'input'> {
value?: string
}

function InputButton(props: InputButtonProps) {
let {
value = 'Test'
} = props;

let ref = useRef();
let {buttonProps, isPressed} = useButton({...props, elementType: 'input'}, ref);

return (
<input ref={ref} value={value} style={{background: isPressed ? 'darkred' : 'red'}} {...buttonProps} />
);
}
2 changes: 2 additions & 0 deletions packages/@react-spectrum/dialog/stories/Dialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ function renderWithForm({width = 'auto', ...props}) {
<Item key="Kangaroo">Kangaroo</Item>
<Item key="Snake">Snake</Item>
</Picker>
<Button UNSAFE_style={{display: 'none'}} variant="primary">Hidden</Button>
<Button UNSAFE_style={{visibility: 'hidden', position: 'absolute'}} variant="primary">Hidden</Button>
<RadioGroup label="Preferred Job" name="jobs">
<Radio value="battery">Battery</Radio>
<Radio value="storage">Information Storage</Radio>
Expand Down