-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathfeatures-zigzag.tsx
230 lines (222 loc) · 9.63 KB
/
features-zigzag.tsx
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import React from 'react';
import CheckboxIcon from './checkbox-icon';
import Link from '@docusaurus/Link';
/**
* The code snippet was created on Carbon.now using the dracula pro theme.
*
* @link https://carbon.now.sh/?bg=rgba%28171%2C184%2C195%2C0%29&t=dracula-pro&wt=none&l=application%2Ftypescript&width=763.5&ds=true&dsyoff=5px&dsblur=11px&wc=true&wa=false&pv=56px&ph=56px&ln=false&fl=1&fm=Hack&fs=14px&lh=133%25&si=false&es=2x&wm=false&code=OpenFeature.setProvider%28new%2520MyProvider%28%29%29%253B%250A%250Aconst%2520featureFlags%2520%253D%2520OpenFeature.getClient%28%29%253B%250A%250Aconst%2520withCows%2520%253D%2520await%2520featureFlags.getBooleanValue%28%2522with-cows%2522%252C%2520false%29%253B%250Aif%2520%28withCows%29%2520%257B%250A%2520%2520res.send%28cowsay.say%28%257B%2520text%253A%2520%2522Hello%252C%2520world%21%2522%2520%257D%29%29%253B%250A%257D%2520else%2520%257B%250A%2520%2520res.send%28%2522Hello%252C%2520world%21%2522%29%253B%250A%257D
*
* NOTE: Please update the link if the image is changed.
*/
import CodeSnippet from '@site/static/img/code-snippet.png';
import { PROVIDERS } from '@site/src/datasets/providers';
import { ECOSYSTEM_SDKS } from '@site/src/datasets/sdks/ecosystem';
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselPrevious,
CarouselNext,
CarouselDots,
} from '../components/ui/carousel';
import Autoplay from 'embla-carousel-autoplay';
const groupItems = (items, groupSize) => {
return items.reduce((acc, item, index) => {
const groupIndex = Math.floor(index / groupSize);
if (!acc[groupIndex]) {
acc[groupIndex] = [];
}
acc[groupIndex].push(item);
return acc;
}, []);
};
const GenericCarousel = ({
items,
}: {
items: Array<{
name: string;
logo: React.ComponentType<React.SVGProps<SVGSVGElement>>;
href: string;
}>;
}) => {
const groupedSDKs = groupItems(items, 6);
return (
<Carousel
className="w-full max-w-xs"
plugins={[
Autoplay({
delay: 5000,
stopOnMouseEnter: true,
}),
]}
>
<CarouselContent>
{groupedSDKs.map((sdks, index) => {
return (
<CarouselItem key={index} className="grid grid-cols-3 gap-4">
{sdks.map((sdk) => {
const Icon = sdk.logo;
return (
<Link
title={sdk.name}
to={sdk.href}
aria-label={sdk.name}
className="flex-auto h-20 w-20 m-4 fill-[#1c1e21] dark:fill-[#e3e3e3] cursor-pointer "
>
<Icon className="h-full w-full hover:fill-primary" />
</Link>
);
})}
</CarouselItem>
);
})}
</CarouselContent>
<CarouselDots />
<CarouselPrevious />
<CarouselNext />
</Carousel>
);
};
function FeaturesZigZag() {
return (
<section>
<div className="max-w-6xl mx-auto px-4 sm:px-6">
<div className="py-12 md:py-20 border-t border-gray-800">
{/* Section header */}
<div className="max-w-3xl mx-auto text-center pb-12 md:pb-16">
<div className="inline-flex text-sm font-semibold py-1 px-3 m-2 text-green-600 bg-green-200 rounded-full mb-4">
Open source
</div>
<h1 className="h2 mb-4">Community driven feature flagging</h1>
<p className="text-xl text-gray-500 dark:text-gray-300 mb-4">
OpenFeature is an open source CNCF incubating project under the Apache 2 license. Check out the project on{' '}
<Link to="https://github.com/open-feature">GitHub</Link> and consider joining the{' '}
<Link to="/community/">OpenFeature community!</Link>
</p>
</div>
{/* Items */}
<div className="grid gap-20">
{/* 1st item */}
<div className="md:grid md:grid-cols-12 md:gap-6 items-center">
{/* Image */}
<div
className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-5 lg:col-span-6 mb-8 md:mb-0 md:order-1"
data-aos="fade-up"
>
<img
className="max-w-full mx-auto md:max-w-none h-auto"
src={CodeSnippet}
width="540"
height="405"
alt="Features 01"
/>
</div>
{/* Content */}
<div
className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-7 lg:col-span-6"
data-aos="fade-right"
>
<div className="md:pr-4 lg:pr-12 xl:pr-16">
<div className="font-architects-daughter text-xl text-purple-600 mb-2">Avoid code-level lock-in</div>
<h3 className="h3 mb-3">One SDK, any backend</h3>
<p className="text-xl text-gray-500 dark:text-gray-300 mb-4">
OpenFeature is designed to work with any feature flag management tool or in-house solution. This
enables you to switch between platforms or consolidate multiple platforms much more easily.
</p>
<ul className="text-lg text-gray-500 dark:text-gray-300 -mb-2 pl-0">
<li className="flex items-center mb-2">
<CheckboxIcon text="Continue to use your current solution" />
</li>
<li className="flex items-center mb-2">
<CheckboxIcon text="Combine multiple solutions behind a single interface" />
</li>
<li className="flex items-center">
<CheckboxIcon text="Try a new solution without a code refactor" />
</li>
</ul>
</div>
</div>
</div>
{/* 2nd item */}
<div className="md:grid md:grid-cols-12 md:gap-6 items-center">
{/* Image */}
<div
className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-5 lg:col-span-6 mb-8 md:mb-0"
data-aos="fade-up"
>
<div className="max-w-full mx-auto md:max-w-none h-auto flex flex-row justify-center fill-[#1c1e21] dark:fill-[#e3e3e3]">
<GenericCarousel
items={PROVIDERS.filter((provider) => !provider.excludeFromLandingPage).map((provider) => ({
name: provider.name,
logo: provider.logo,
href: encodeURI(`/ecosystem?instant_search[refinementList][vendor][0]=${provider.name}`),
}))}
/>
</div>
</div>
{/* Content */}
<div
className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-7 lg:col-span-6"
data-aos="fade-left"
>
<div className="md:pl-4 lg:pl-12 xl:pl-16">
<div className="font-architects-daughter text-xl text-purple-600 mb-2">
Developed with the industry
</div>
<h3 className="h3 mb-3">Supports your favorite tools</h3>
<p className="text-xl text-gray-500 dark:text-gray-300 mb-4">
OpenFeature has broad industry support, and many of the top open source and commercial tools have
created officially-supported providers.
</p>
<ul className="text-lg text-gray-500 dark:text-gray-300 -mb-2 pl-0">
<li className="flex items-center mb-2">
<CheckboxIcon text="Works with your favorite vendor" />
</li>
<li className="flex items-center mb-2">
<CheckboxIcon text="Integrates with popular open source projects" />
</li>
<li className="flex items-center">
<CheckboxIcon text="Add support to your home grown solution" />
</li>
</ul>
</div>
</div>
</div>
{/* 3rd item */}
<div className="md:grid md:grid-cols-12 md:gap-6 items-center">
{/* Image */}
<div
className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-5 lg:col-span-6 mb-8 md:mb-0 md:order-1"
data-aos="fade-up"
>
<div className="max-w-full mx-auto md:max-w-none h-auto flex flex-row justify-center">
<GenericCarousel
items={ECOSYSTEM_SDKS.map((sdk) => ({
name: sdk.title,
logo: sdk.logo,
href: sdk.href,
}))}
/>
</div>
</div>
{/* Content */}
<div
className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-7 lg:col-span-6"
data-aos="fade-right"
>
<div className="md:pr-4 lg:pr-12 xl:pr-16">
<div className="font-architects-daughter text-xl text-purple-600 mb-2">Ultimate flexibility</div>
<h3 className="h3 mb-3">Speaks your language</h3>
<p className="text-xl text-gray-500 dark:text-gray-300 mb-4">
OpenFeature supports many of the top programming languages, with more on the way.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
);
}
export default FeaturesZigZag;