mirror of
https://github.com/morten-olsen/react-native-debug-console.git
synced 2026-02-08 00:36:26 +01:00
V2 (#1)
This commit is contained in:
31
packages/lib/src/components/base/Toolbar/Button.js
Normal file
31
packages/lib/src/components/base/Toolbar/Button.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components/native';
|
||||
import Icon from '../Icon';
|
||||
import {
|
||||
Body,
|
||||
} from '../text';
|
||||
|
||||
const Item = styled.TouchableOpacity`
|
||||
padding: 10px 10px;
|
||||
opacity: ${({ disabled }) => disabled ? 0.3 : 1};
|
||||
`;
|
||||
|
||||
const Button = ({
|
||||
name,
|
||||
icon,
|
||||
onPress,
|
||||
disabled,
|
||||
}) => (
|
||||
<Item
|
||||
onPress={disabled ? undefined : onPress}
|
||||
disabled={disabled}
|
||||
>
|
||||
{icon ? (
|
||||
<Icon name={icon} />
|
||||
) : (
|
||||
<Body color={disabled ? '#ccc' : undefined}>{name}</Body>
|
||||
)}
|
||||
</Item>
|
||||
);
|
||||
|
||||
export default Button;
|
||||
Reference in New Issue
Block a user