Skip to content

Commit

Permalink
WebUI: Align integration and plugin tiles (#49029)
Browse files Browse the repository at this point in the history
* align integration and plugin tiles

* update integrationtile test
  • Loading branch information
flyinghermit authored Nov 15, 2024
1 parent 9356889 commit deedeb7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('render', async () => {
</MemoryRouter>
);

expect(screen.getByText(/amazon web services/i)).toBeInTheDocument();
expect(screen.getByText(/AWS OIDC Identity Provider/i)).toBeInTheDocument();
expect(screen.queryByText(/no permission/i)).not.toBeInTheDocument();
expect(screen.getAllByTestId('res-icon-aws')).toHaveLength(2);
expect(screen.getAllByRole('link')).toHaveLength(2);
Expand Down
28 changes: 14 additions & 14 deletions web/packages/teleport/src/Integrations/Enroll/IntegrationTiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import React from 'react';
import { Link } from 'react-router-dom';
import { Text, Box, ResourceIcon } from 'design';
import { Text, Flex } from 'design';

import cfg from 'teleport/config';
import {
Expand All @@ -27,7 +27,7 @@ import {
} from 'teleport/components/ToolTipNoPermBadge';
import { IntegrationKind } from 'teleport/services/integrations';

import { IntegrationTile } from './common';
import { IntegrationTile, IntegrationIcon } from './common';

export function IntegrationTiles({
hasIntegrationAccess = true,
Expand All @@ -52,14 +52,12 @@ export function IntegrationTiles({
}
data-testid="tile-aws-oidc"
>
<Box mt={3} mb={2}>
<ResourceIcon name="aws" width="80px" />
</Box>
<Text>
Amazon Web Services
<br />
OIDC
</Text>
<Flex flexBasis={100}>
<IntegrationIcon name="aws" />
</Flex>
<Flex flexBasis={50}>
<Text>AWS OIDC Identity Provider</Text>
</Flex>
{!hasIntegrationAccess && (
<ToolTipNoPermBadge
children={
Expand All @@ -85,10 +83,12 @@ export function IntegrationTiles({
}
data-testid="tile-external-audit-storage"
>
<Box mt={3} mb={2}>
<ResourceIcon name="aws" width="80px" />
</Box>
<Text>AWS External Audit Storage</Text>
<Flex flexBasis={100}>
<IntegrationIcon name="aws" />
</Flex>
<Flex flexBasis={50}>
<Text>AWS External Audit Storage</Text>
</Flex>
{renderExternalAuditStorageBadge(
hasExternalAuditStorage,
externalAuditStorageEnabled
Expand Down
18 changes: 17 additions & 1 deletion web/packages/teleport/src/Integrations/Enroll/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import React from 'react';
import { Box, Flex, H2 } from 'design';
import { Box, Flex, H2, ResourceIcon } from 'design';
import styled from 'styled-components';
import { P } from 'design/Text/Text';

Expand All @@ -29,8 +29,10 @@ export const IntegrationTile = styled(Flex)<{
text-decoration: none;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
border-radius: 4px;
padding: 15px 10px 6px 10px;
height: 170px;
width: 170px;
background-color: ${({ theme }) => theme.colors.buttons.secondary.default};
Expand Down Expand Up @@ -60,3 +62,17 @@ export const NoCodeIntegrationDescription = () => (
</P>
</Box>
);

/**
* IntegrationIcon wraps ResourceIcon with css required for integration
* and plugin tiles.
*/
export const IntegrationIcon = styled(ResourceIcon)<{ size?: number }>`
display: inline-block;
height: 100%;
${({ size }) =>
size &&
`
max-height: ${size}px;
`}
`;

0 comments on commit deedeb7

Please sign in to comment.