diff --git a/src/plugins/navigation/components/FavoriteButton.js b/src/plugins/navigation/components/FavoriteButton.js new file mode 100644 index 000000000..c7b582122 --- /dev/null +++ b/src/plugins/navigation/components/FavoriteButton.js @@ -0,0 +1,47 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ + +import {styled} from 'flipper'; +import {IconButton} from './'; + +type Props = {| + onClick?: () => void, + highlighted: boolean, + size: 8 | 10 | 12 | 16 | 18 | 20 | 24 | 32, +|}; + +const FavoriteButtonContainer = styled('div')({ + position: 'relative', + '>:first-child': { + position: 'absolute', + }, + '>:last-child': { + position: 'relative', + }, +}); + +export default (props: Props) => { + const {highlighted, onClick, ...iconButtonProps} = props; + return ( + + {highlighted ? ( + + ) : null} + + + ); +}; diff --git a/src/plugins/navigation/components/NavigationInfoBox.js b/src/plugins/navigation/components/NavigationInfoBox.js index 367056142..e0a574014 100644 --- a/src/plugins/navigation/components/NavigationInfoBox.js +++ b/src/plugins/navigation/components/NavigationInfoBox.js @@ -8,7 +8,7 @@ import {styled} from 'flipper'; import {parseURIParameters} from '../util/uri'; -import {IconButton} from './'; +import {IconButton, FavoriteButton} from './'; type Props = {| uri: ?string, @@ -64,7 +64,11 @@ export default (props: Props) => { return (
- + props.onFavorite(uri)} + /> void, @@ -29,12 +29,12 @@ const IconContainer = styled('div')({ display: 'inline-flex', height: '16px', alignItems: 'center', - '>*': { + '': { marginLeft: 10, '.icon-button': { height: 16, }, - img: { + 'img,div': { verticalAlign: 'top', alignItems: 'none', }, @@ -86,10 +86,9 @@ class SearchBar extends Component { outline={true} onClick={() => this.navigateTo(this.state.query)} /> - this.favorite(this.state.query)} /> diff --git a/src/plugins/navigation/components/index.js b/src/plugins/navigation/components/index.js index 048cacf2c..429d0d35e 100644 --- a/src/plugins/navigation/components/index.js +++ b/src/plugins/navigation/components/index.js @@ -6,6 +6,7 @@ * @flow strict-local */ +export {default as FavoriteButton} from './FavoriteButton'; export {default as IconButton} from './IconButton'; export {default as NavigationInfoBox} from './NavigationInfoBox'; export {default as ScrollableFlexColumn} from './ScrollableFlexColumn';