Add 'depressed' param to Button
Summary: Adds an optional 'depressed' param to Button. If set to true, displays the Button as if it was depressed. Used to add a set of togglable buttons in which all or none can be selected. Reviewed By: jknoxville Differential Revision: D8903854 fbshipit-source-id: ff39bed91514e420b49cb75fe57e490fa641b810
This commit is contained in:
committed by
Facebook Github Bot
parent
41f4478a74
commit
e223595941
@@ -19,6 +19,8 @@ const borderColor = props => {
|
|||||||
return colors.macOSTitleBarButtonBorderBlur;
|
return colors.macOSTitleBarButtonBorderBlur;
|
||||||
} else if (props.type === 'danger') {
|
} else if (props.type === 'danger') {
|
||||||
return colors.red;
|
return colors.red;
|
||||||
|
} else if (props.depressed) {
|
||||||
|
return colors.macOSTitleBarButtonBorderBottom;
|
||||||
} else {
|
} else {
|
||||||
return colors.macOSTitleBarButtonBorder;
|
return colors.macOSTitleBarButtonBorder;
|
||||||
}
|
}
|
||||||
@@ -42,12 +44,23 @@ const StyledButton = styled.view(
|
|||||||
return colors.white;
|
return colors.white;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
backgroundImage: props =>
|
backgroundImage: props => {
|
||||||
props.windowIsFocused
|
if (props.windowIsFocused) {
|
||||||
? `linear-gradient(to bottom, transparent 0%,${
|
if (props.depressed) {
|
||||||
|
return `linear-gradient(to bottom, ${
|
||||||
|
colors.macOSTitleBarBorderBlur
|
||||||
|
} 1px, ${colors.macOSTitleBarButtonBorderBlur} 0%, ${
|
||||||
|
colors.macOSTitleBarButtonBackgroundActive
|
||||||
|
} 100%)`;
|
||||||
|
} else {
|
||||||
|
return `linear-gradient(to bottom, transparent 0%,${
|
||||||
colors.macOSTitleBarButtonBackground
|
colors.macOSTitleBarButtonBackground
|
||||||
} 100%)`
|
} 100%)`;
|
||||||
: 'none',
|
}
|
||||||
|
} else {
|
||||||
|
return 'none';
|
||||||
|
}
|
||||||
|
},
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor,
|
borderColor,
|
||||||
@@ -192,6 +205,10 @@ type Props = {
|
|||||||
* URL to open in the browser on click
|
* URL to open in the browser on click
|
||||||
*/
|
*/
|
||||||
href?: string,
|
href?: string,
|
||||||
|
/**
|
||||||
|
* Whether the button should render depressed into its socket
|
||||||
|
*/
|
||||||
|
depressed?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
|||||||
Reference in New Issue
Block a user