-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
509 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
ts/features/messages/components/MessageDetail/OrganizationHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from "react"; | ||
import { ImageURISource, StyleSheet, View } from "react-native"; | ||
import { | ||
Avatar, | ||
IOSpacingScale, | ||
IOStyles, | ||
LabelSmall | ||
} from "@pagopa/io-app-design-system"; | ||
|
||
export type OrganizationHeaderProps = { | ||
organizationName: string; | ||
serviceName: string; | ||
logoUri: ImageURISource; | ||
accessibilityLabel?: string; | ||
}; | ||
|
||
const ITEM_PADDING_VERTICAL: IOSpacingScale = 6; | ||
const AVATAR_MARGIN_LEFT: IOSpacingScale = 16; | ||
|
||
const styles = StyleSheet.create({ | ||
item: { | ||
flexDirection: "row", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
paddingVertical: ITEM_PADDING_VERTICAL | ||
}, | ||
itemAvatar: { | ||
marginLeft: AVATAR_MARGIN_LEFT | ||
} | ||
}); | ||
|
||
export const OrganizationHeader = ({ | ||
logoUri, | ||
organizationName, | ||
serviceName, | ||
...rest | ||
}: OrganizationHeaderProps) => ( | ||
<View {...rest} accessible={true} style={styles.item}> | ||
<View style={IOStyles.flex}> | ||
<LabelSmall fontSize="regular" color="grey-700"> | ||
{organizationName} | ||
</LabelSmall> | ||
<LabelSmall fontSize="regular" color="blueIO-500"> | ||
{serviceName} | ||
</LabelSmall> | ||
</View> | ||
<View style={styles.itemAvatar}> | ||
<Avatar logoUri={logoUri} size="small" shape="circle" /> | ||
</View> | ||
</View> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
ts/features/messages/components/MessageDetail/__tests__/OrganizationHeader.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
import { render } from "@testing-library/react-native"; | ||
import { OrganizationHeader } from "../OrganizationHeader"; | ||
|
||
describe("OrganizationHeader component", () => { | ||
it("should match the snapshot", () => { | ||
const component = render( | ||
<OrganizationHeader | ||
logoUri={{ | ||
uri: "https://eo.wikipedia.org/wiki/Universala_Esperanto-Asocio#/media/Dosiero:Universala_Esperanto-Asocio.png" | ||
}} | ||
organizationName={"Universala Esperanto-Asocio"} | ||
serviceName={"Avviso"} | ||
/> | ||
); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.