Skip to content

Commit

Permalink
feat: integration sections (#4631)
Browse files Browse the repository at this point in the history
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
  • Loading branch information
Tymek and sjaanus committed Sep 7, 2023
1 parent 1d414db commit 2be77fb
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 35 deletions.
Expand Up @@ -4,47 +4,135 @@ import useLoading from 'hooks/useLoading';
import { PageContent } from 'component/common/PageContent/PageContent';
import { PageHeader } from 'component/common/PageHeader/PageHeader';
import { IntegrationCard } from '../IntegrationCard/IntegrationCard';
import { StyledCardsGrid } from '../IntegrationList.styles';
import { JIRA_INFO } from '../../JiraIntegration/JiraIntegration';
import { StyledCardsGrid } from '../IntegrationList.styles';
import { Paper, Typography, styled } from '@mui/material';

interface IAvailableIntegrationsProps {
providers: AddonTypeSchema[];
loading?: boolean;
}

const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(12),
}));

const StyledSection = styled('section')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(2),
}));

/**
* @deprecated
* // TODO: refactor
*/
const StyledGrayContainer = styled('div')(({ theme }) => ({
backgroundColor: theme.palette.background.elevation1,
borderRadius: theme.shape.borderRadiusLarge,
padding: theme.spacing(3),
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(1),
}));

export const AvailableIntegrations: VFC<IAvailableIntegrationsProps> = ({
providers,
loading,
}) => {
const customProviders = [JIRA_INFO];

const ref = useLoading(loading || false);

return (
<PageContent
header={<PageHeader title="Available integrations" />}
header={<PageHeader title="Integrations" secondary />}
isLoading={loading}
ref={ref}
>
<StyledCardsGrid ref={ref}>
{providers?.map(({ name, displayName, description }) => (
<IntegrationCard
key={name}
icon={name}
title={displayName || name}
description={description}
link={`/integrations/create/${name}`}
/>
))}
{customProviders?.map(({ name, displayName, description }) => (
<IntegrationCard
key={name}
icon={name}
title={displayName || name}
description={description}
link={`/integrations/view/${name}`}
configureActionText={'View integration'}
/>
))}
</StyledCardsGrid>
<StyledContainer>
<StyledSection>
<div>
<Typography component="h3" variant="h2">
Title
</Typography>
<Typography variant="body2" color="text.secondary">
Description
</Typography>
</div>
<StyledCardsGrid>
{providers?.map(
({ name, displayName, description }) => (
<IntegrationCard
key={name}
icon={name}
title={displayName || name}
description={description}
link={`/integrations/create/${name}`}
/>
)
)}
{customProviders?.map(
({ name, displayName, description }) => (
<IntegrationCard
key={name}
icon={name}
title={displayName || name}
description={description}
link={`/integrations/view/${name}`}
configureActionText={'View integration'}
/>
)
)}
</StyledCardsGrid>
</StyledSection>
<StyledSection>
<div>
<Typography component="h3" variant="h2">
Performance and security
</Typography>
<Typography variant="body2" color="text.secondary">
Description
</Typography>
</div>
<StyledCardsGrid small>
{/* TODO: edge and proxy */}
{/* {providers?.map(
({ name, displayName, description }) => (
<IntegrationCard
key={name}
icon={name}
title={displayName || name}
description={description}
link={`/integrations/create/${name}`}
/>
)
)} */}
</StyledCardsGrid>
</StyledSection>
<StyledSection>
<StyledGrayContainer>
<div>
<Typography component="h3" variant="h2">
Other
</Typography>
<Typography>
<a
href="https://docs.getunleash.io/reference/sdks#community-sdks"
target="_blank"
rel="noopener noreferrer"
>
Here's some of the fantastic work
</a>{' '}
our community has build to make Unleash work in
even more contexts.
</Typography>
</div>
</StyledGrayContainer>
</StyledSection>
</StyledContainer>
</PageContent>
);
};
@@ -1,8 +1,12 @@
import { styled } from '@mui/material';

export const StyledCardsGrid = styled('div')(({ theme }) => ({
gridTemplateColumns: 'repeat(auto-fit, minmax(350px, 1fr))',
gridAutoRows: '1fr',
gap: theme.spacing(2),
display: 'grid',
}));
export const StyledCardsGrid = styled('div')<{ small?: boolean }>(
({ theme, small = false }) => ({
gridTemplateColumns: `repeat(auto-fit, minmax(${
small ? '250px' : '350px'
}, 1fr))`,
gridAutoRows: '1fr',
gap: theme.spacing(2),
display: 'grid',
})
);
Expand Up @@ -5,31 +5,30 @@ import { IntegrationIcon } from '../IntegrationList/IntegrationIcon/IntegrationI
import cr from 'assets/img/jira/cr.png';
import connect from 'assets/img/jira/connect.png';
import manage from 'assets/img/jira/manage.png';
import React from 'react';
import { JiraImageContainer } from './JiraImageContainer';

export const StyledContainer = styled('div')(({ theme }) => ({
const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(2),
}));

export const StyledGrayContainer = styled('div')(({ theme }) => ({
backgroundColor: theme.palette.grey[100],
const StyledGrayContainer = styled('div')(({ theme }) => ({
backgroundColor: theme.palette.background.elevation1,
borderRadius: theme.shape.borderRadiusLarge,
padding: theme.spacing(3),
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(1),
}));

export const StyledIconLine = styled('div')(({ theme }) => ({
const StyledIconLine = styled('div')(({ theme }) => ({
display: 'flex',
marginLeft: theme.spacing(1),
alignItems: 'center',
}));

export const StyledLink = styled('a')({
const StyledLink = styled('a')({
textDecoration: 'none',
});

Expand Down

0 comments on commit 2be77fb

Please sign in to comment.