Files
flipper/desktop/app/src/ui/components/ToolbarIcon.tsx
Michel Weststrate 84c6e05b8a Wire up tracking to Sandy Chrome
Summary: Wired up tracking to all chrome sections and some import UI elements

Reviewed By: jknoxville

Differential Revision: D25219089

fbshipit-source-id: c75bed91894609dafc5fcc6423a5228211fb92d8
2020-12-03 04:15:45 -08:00

50 lines
1.2 KiB
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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 from './Glyph';
import Tooltip from './Tooltip';
import {colors} from './colors';
import styled from '@emotion/styled';
import React from 'react';
import {Tracked} from 'flipper-plugin';
type Props = React.ComponentProps<typeof ToolbarIconContainer> & {
active?: boolean;
icon: string;
title: string;
onClick: () => void;
};
const ToolbarIconContainer = styled.div({
marginRight: 9,
marginTop: -3,
marginLeft: 4,
position: 'relative', // for settings popover positioning
});
export default function ToolbarIcon({active, icon, title, ...props}: Props) {
return (
<Tooltip title={title}>
<Tracked action={title}>
<ToolbarIconContainer {...props}>
<Glyph
name={icon}
size={16}
color={
active
? colors.macOSTitleBarIconSelected
: colors.macOSTitleBarIconActive
}
/>
</ToolbarIconContainer>
</Tracked>
</Tooltip>
);
}