Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | import {
Divider,
Flex,
Grid,
Icon as ChakraIcon,
Image,
Stack,
useColorModeValue,
} from "@chakra-ui/react";
import type { FunctionComponent } from "react";
import { HOME_ANALYTICS, SECTION_PADDING } from "./constants";
import { InfoSection } from "./InfoSection";
import testIds from "./testIds";
import { CatalogSearchSort } from "../../api/catalog-search/constants";
import { NavLink } from "../../components/NavLink";
import { CDKType, CDKTYPE_RENDER_MAP } from "../../constants/constructs";
import {
Language,
LANGUAGE_RENDER_MAP,
TEMP_SUPPORTED_LANGUAGES,
} from "../../constants/languages";
import { AWSIcon } from "../../icons/AWSIcon";
import { DatadogIcon } from "../../icons/DatadogIcon";
import { MongoDBIcon } from "../../icons/MongoDBIcon";
import { getSearchPath } from "../../util/url";
const publishers = [
{
name: "Datadog",
Icon: DatadogIcon,
url: getSearchPath({ keywords: ["Datadog"] }),
},
{
name: "AWS",
Icon: AWSIcon,
url: getSearchPath({ query: "AWS" }),
},
{
name: "MongoDB",
Icon: MongoDBIcon,
url: getSearchPath({ keywords: ["MongoDB"] }),
},
{
name: "Aqua Security",
imgsrc: "/assets/aqua-security.png",
url: getSearchPath({ keywords: ["aqua"] }),
},
];
const IconLink = ({
url,
imgsrc,
label,
Icon,
}: {
url: string;
label: string;
imgsrc?: string;
Icon?: typeof ChakraIcon;
}) => {
const imgFilter = useColorModeValue(
undefined,
"invert(100%) brightness(1.5)"
);
return (
<NavLink
color="link"
data-event={HOME_ANALYTICS.INFO.eventName(label)}
data-testid={testIds.infoSectionIcon}
fontWeight="bold"
to={url}
>
<Stack align="center" spacing={2} textAlign="center">
{imgsrc && (
<Image
aria-label={label}
filter={label === "AWS CDK" ? imgFilter : undefined}
h={8}
src={imgsrc}
/>
)}
{Icon && <Icon aria-label={label} h={8} w={8} />}
<span>{label}</span>
</Stack>
</NavLink>
);
};
const ResponsiveDivider = () => (
<>
<Divider display={{ xl: "none" }} w="auto" />
<Divider
display={{ base: "none", xl: "initial" }}
h="auto"
my={SECTION_PADDING.Y}
orientation="vertical"
/>
</>
);
const Row: FunctionComponent = ({ children }) => (
<Flex align="center" pt={4} sx={{ gap: "2rem" }}>
{children}
</Flex>
);
export const Info: FunctionComponent = () => (
<Flex bg="bgSecondary" data-testid={testIds.infoContainer} direction="column">
<Grid
gap={SECTION_PADDING.Y}
paddingX={SECTION_PADDING.X}
templateColumns={{ base: "1fr", xl: "1fr auto 1fr auto 1fr" }}
templateRows={{ base: "1fr auto 1fr auto 1fr", xl: "auto" }}
>
<InfoSection
description="Find libraries for AWS Cloud Development Kit (AWS CDK), which generates AWS CloudFormation templates, CDK for Terraform (CDKTF), which generates HashiCorp Terraform configuration files, and CDK for Kubernetes (CDK8s), which generates Kubernetes manifests."
title="One home for all CDKs"
>
<Row>
{Object.entries(CDKTYPE_RENDER_MAP).map(
([cdktype, { name, imgsrc }]) => (
<IconLink
imgsrc={imgsrc}
key={cdktype}
label={name}
url={getSearchPath({
cdkType: cdktype as CDKType,
sort: CatalogSearchSort.DownloadsDesc,
})}
/>
)
)}
</Row>
</InfoSection>
<ResponsiveDivider />
<InfoSection
description="Define, test, and deploy cloud infrastructure using high level programming languages such as TypeScript, Python, Java, and .NET. Find documentation, API references and code samples to quickly build your application."
title="Support across languages"
>
<Row>
{Object.entries(LANGUAGE_RENDER_MAP)
.filter(([language]) =>
TEMP_SUPPORTED_LANGUAGES.has(language as Language)
)
.map(([language, { icon: Icon, name }]) => (
<IconLink
Icon={Icon as typeof ChakraIcon}
key={language}
label={name}
url={getSearchPath({
languages: [language as Language],
sort: CatalogSearchSort.DownloadsDesc,
})}
/>
))}
</Row>
</InfoSection>
<ResponsiveDivider />
<InfoSection
description="Find construct libraries published by the community and cloud service providers such as Datadog, Amazon Web Services (AWS), MongoDB, Aqua Security, and more."
title="Provision a range of cloud resources"
>
<Row>
{publishers.map(({ url, name, imgsrc, Icon }) => (
<IconLink
Icon={Icon}
imgsrc={imgsrc}
key={name}
label={name}
url={url}
/>
))}
</Row>
</InfoSection>
</Grid>
</Flex>
);
|