diff --git a/src/index.js b/src/index.js index f049e11f3..82558c6bf 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ * @format */ -export {default as styled} from 'react-emotion'; +export {default as styled, keyframes} from 'react-emotion'; export * from './ui/index.js'; export * from './utils/index.js'; export {default as GK} from './fb-stubs/GK.js'; diff --git a/src/plugins/navigation/components/IconButton.js b/src/plugins/navigation/components/IconButton.js new file mode 100644 index 000000000..8969ae296 --- /dev/null +++ b/src/plugins/navigation/components/IconButton.js @@ -0,0 +1,62 @@ +/** + * 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 {Glyph, styled, keyframes} from 'flipper'; + +const shrinkAnimation = keyframes({ + '0%': { + transform: 'scale(1);', + }, + '100%': { + transform: 'scale(.9)', + }, +}); + +type Props = {| + icon: string, + outline?: boolean, + onClick?: () => void, + color?: string, + size: 8 | 10 | 12 | 16 | 18 | 20 | 24 | 32, +|}; + +const RippleEffect = styled('div')({ + padding: 5, + borderRadius: 100, + backgroundPosition: 'center', + transition: 'background 0.5s', + ':hover': { + background: + 'rgba(155, 155, 155, 0.2) radial-gradient(circle, transparent 1%, rgba(155, 155, 155, 0.2) 1%) center/15000%', + }, + ':active': { + backgroundColor: 'rgba(201, 200, 200, 0.5)', + backgroundSize: '100%', + transition: 'background 0s', + }, +}); + +const IconButton = styled('div')({ + ':active': { + animation: `${shrinkAnimation} .25s ease forwards`, + }, +}); + +export default function(props: Props) { + return ( + + + + + + ); +} diff --git a/src/plugins/navigation/components/NavigationInfoBox.js b/src/plugins/navigation/components/NavigationInfoBox.js index c4310c5b9..dbeff7a24 100644 --- a/src/plugins/navigation/components/NavigationInfoBox.js +++ b/src/plugins/navigation/components/NavigationInfoBox.js @@ -8,6 +8,7 @@ import {styled} from 'flipper'; import {parseURIParameters} from '../util/uri'; +import {IconButton} from './'; type Props = {| uri: ?string, @@ -37,6 +38,16 @@ const NavigationInfoBoxContainer = styled('div')({ userSelect: 'text', cursor: 'text', }, + '.icon-container': { + display: 'inline-flex', + padding: 5, + position: 'absolute', + top: 0, + right: 0, + '>*': { + marginRight: 2, + }, + }, }); export default (props: Props) => { @@ -51,6 +62,10 @@ export default (props: Props) => { const parameters = parseURIParameters(uri); return ( +
+ + +
uri:
{uri}
{parameters.size > 0 ? ( diff --git a/src/plugins/navigation/components/SearchBar.js b/src/plugins/navigation/components/SearchBar.js index abe5654a7..374e75a26 100644 --- a/src/plugins/navigation/components/SearchBar.js +++ b/src/plugins/navigation/components/SearchBar.js @@ -14,7 +14,7 @@ import { Toolbar, Glyph, } from 'flipper'; -import {SearchBarButton} from './'; +import {IconButton} from './'; type Props = {| onFavorite: (query: string) => void, @@ -25,6 +25,22 @@ type State = {| query: string, |}; +const IconContainer = styled('div')({ + display: 'inline-flex', + height: '16px', + alignItems: 'center', + '>*': { + marginLeft: 10, + '.icon-button': { + height: 16, + }, + img: { + verticalAlign: 'top', + alignItems: 'none', + }, + }, +}); + const SearchChevronContainer = styled('div')({ marginRight: 12, }); @@ -63,14 +79,20 @@ class SearchBar extends Component { - this.navigateTo(this.state.query)} - /> - this.favorite(this.state.query)} - /> + + this.navigateTo(this.state.query)} + /> + this.favorite(this.state.query)} + /> + ); }; diff --git a/src/plugins/navigation/components/SearchBarButton.js b/src/plugins/navigation/components/SearchBarButton.js deleted file mode 100644 index 7412142c6..000000000 --- a/src/plugins/navigation/components/SearchBarButton.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 {Glyph, styled} from 'flipper'; - -type Props = {| - icon: string, - onClick?: () => void, -|}; - -const SearchBarButton = styled('div')({ - marginRight: 9, - marginTop: -3, - marginLeft: 4, - position: 'relative', -}); - -export default function(props: Props) { - return ( - - - - ); -} diff --git a/src/plugins/navigation/components/index.js b/src/plugins/navigation/components/index.js index 5fb0c608f..907d8c41e 100644 --- a/src/plugins/navigation/components/index.js +++ b/src/plugins/navigation/components/index.js @@ -6,6 +6,6 @@ * @flow strict-local */ +export {default as IconButton} from './IconButton'; export {default as NavigationInfoBox} from './NavigationInfoBox'; export {default as SearchBar} from './SearchBar'; -export {default as SearchBarButton} from './SearchBarButton';