Files
iNaturalistReactNative/src/components/SharedComponents/UserIcon/UserIcon.js
Johannes Klein 621c39dfda 415 snapshot testing for UI buttons (#458)
* Add font weight to Typography elements

* Add Heading5

* Typography snapshot tests

* Add letterSpacing to Heading 4 and 5

* Update Button padding

* Update Button styling

* Add rounded-lg

* Code style and comments

* Add button tests

* Added loading state color to buttons

* Add default color to text

* Use text class name instead

* Change text

* Add non default color text

* Snapshot for icon

* Default text color into button snap

* Update INatIcon.js

* Add Divider component

* Updates to Tabs UI

* Update color

* Add Divider test

* Show underline only when active

* Tabs snapshot

* Update Button UI

* Revert "Update Button UI"

This reverts commit 5361f57dac.

* Update ActivityCount.js

* Get color from theme in buttons

* Use translated string for hints in Tabs snapshots

* Refactor fct args

* Update Tabs

* Remove async

* Use .each in Button test

* Remove comment

* Structuring

* Remove duplicate application of style defaults

* Remove async from Typography
2023-02-15 11:31:16 +01:00

33 lines
972 B
JavaScript

// @flow
import classNames from "classnames";
import { Image } from "components/styledComponents";
import * as React from "react";
import colors from "styles/tailwindColors";
type Props = {
uri: Object,
small?: boolean,
active?: boolean
}
const UserIcon = ( { uri, small, active }: Props ): React.Node => {
const size = small ? "w-[22px] h-[22px]" : "w-[40px] h-[40px]";
const border = "border-[3px] border-inatGreen";
const className = classNames( "rounded-full", size, active && border );
// For unknown reasons, the green border doesn't show up on Android using nativewind classNames
// but it works with style, might warrant further investigation or an issue in nativewind
const style = { borderColor: colors.inatGreen, borderWidth: 3 };
return (
<Image
testID="UserIcon.photo"
className={className}
style={active && style}
source={uri}
accessibilityIgnoresInvertColors
/>
);
};
export default UserIcon;