Skip to content

Commit cb3f1de

Browse files
authored
[Docs] Rework home page (#2368)
Preview: https://yatarkan.github.io/openvino.genai/
1 parent 6fec1bb commit cb3f1de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1131
-661
lines changed

site/docs/concepts/beam-search.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ sidebar_position: 3
33
---
44

55
# Beam Search
6+
7+
> **Note:** This page is a work in progress.

site/docs/concepts/optimization-techniques/continuous-batching.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ sidebar_position: 3
33
---
44

55
# Continuous Batching
6+
7+
> **Note:** This page is a work in progress.

site/docs/concepts/optimization-techniques/prefix-caching.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ sidebar_position: 4
33
---
44

55
# Prefix Caching
6+
7+
> **Note:** This page is a work in progress.

site/docs/concepts/optimization-techniques/speculative-decoding.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ sidebar_position: 1
33
---
44

55
# Speculative Decoding
6+
7+
> **Note:** This page is a work in progress.

site/docusaurus.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ const config: Config = {
8686
label: 'Documentation',
8787
to: '/docs',
8888
},
89-
{
90-
type: 'html',
91-
position: 'left',
92-
value: '<i style="color: #fec91b"><b>Status:</b> Work in progress</i>',
93-
},
9489
{
9590
href: 'https://github.com/openvinotoolkit/openvino.genai',
9691
label: 'GitHub',

site/src/components/Button/index.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,9 @@ export default function Button({
4545
const destination = disabled ? null : link;
4646

4747
return (
48-
<Link to={destination}>
48+
<Link className={className} to={destination}>
4949
<button
50-
className={clsx(
51-
'button',
52-
sizeClass,
53-
outlineClass,
54-
variantClass,
55-
blockClass,
56-
disabledClass,
57-
className
58-
)}
50+
className={clsx('button', sizeClass, outlineClass, variantClass, blockClass, disabledClass)}
5951
style={style}
6052
role="button"
6153
aria-disabled={disabled}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
import clsx from 'clsx';
2+
import React, { useEffect, useRef, useState } from 'react';
3+
4+
import styles from './styles.module.css';
5+
6+
type ChevronIconProps = {
7+
size?: number;
8+
};
9+
10+
const ChevronLeftIcon: React.FC<ChevronIconProps> = ({ size = 24 }) => (
11+
<svg
12+
width={size}
13+
height={size}
14+
viewBox="0 0 24 24"
15+
fill="none"
16+
stroke="currentColor"
17+
strokeWidth="2.5"
18+
>
19+
<polyline points="15,18 9,12 15,6"></polyline>
20+
</svg>
21+
);
22+
23+
const ChevronRightIcon: React.FC<ChevronIconProps> = ({ size = 24 }) => (
24+
<svg
25+
width={size}
26+
height={size}
27+
viewBox="0 0 24 24"
28+
fill="none"
29+
stroke="currentColor"
30+
strokeWidth="2.5"
31+
>
32+
<polyline points="9,18 15,12 9,6"></polyline>
33+
</svg>
34+
);
35+
36+
type CarouselProps = {
37+
slides: React.ReactNode[];
38+
autoSlideTimeout?: number;
39+
enableAutoSlide?: boolean;
40+
slidesToShow?: number;
41+
};
42+
43+
const Carousel: React.FC<CarouselProps> = ({
44+
slides = [],
45+
autoSlideTimeout = 5000,
46+
enableAutoSlide = true,
47+
slidesToShow = 1,
48+
}) => {
49+
const [currentSlide, setCurrentSlide] = useState(0);
50+
const [isPaused, setIsPaused] = useState(false);
51+
const timeoutRef = useRef(null);
52+
53+
const totalSlides = slides.length;
54+
const slideWidth = 100 / slidesToShow;
55+
const maxSlideIndex = Math.max(0, totalSlides - slidesToShow);
56+
57+
const slidesPages = totalSlides - slidesToShow + 1;
58+
59+
useEffect(() => {
60+
if (!enableAutoSlide || isPaused || totalSlides <= slidesToShow) {
61+
return;
62+
}
63+
64+
timeoutRef.current = setTimeout(() => {
65+
setCurrentSlide((prev) => {
66+
const nextSlide = prev + 1;
67+
return nextSlide > maxSlideIndex ? 0 : nextSlide;
68+
});
69+
}, autoSlideTimeout);
70+
71+
return () => {
72+
if (timeoutRef.current) {
73+
clearTimeout(timeoutRef.current);
74+
}
75+
};
76+
}, [
77+
currentSlide,
78+
autoSlideTimeout,
79+
enableAutoSlide,
80+
isPaused,
81+
totalSlides,
82+
slidesToShow,
83+
maxSlideIndex,
84+
]);
85+
86+
const goToSlide = (index) => {
87+
const clampedIndex = Math.min(Math.max(0, index), maxSlideIndex);
88+
setCurrentSlide(clampedIndex);
89+
};
90+
91+
const goToPrevious = () => {
92+
setCurrentSlide((prev) => {
93+
return prev === 0 ? maxSlideIndex : prev - 1;
94+
});
95+
};
96+
97+
const goToNext = () => {
98+
setCurrentSlide((prev) => {
99+
const nextSlide = prev + 1;
100+
return nextSlide > maxSlideIndex ? 0 : nextSlide;
101+
});
102+
};
103+
104+
const handleMouseEnter = () => {
105+
setIsPaused(true);
106+
};
107+
108+
const handleMouseLeave = () => {
109+
setIsPaused(false);
110+
};
111+
112+
if (!slides || slides.length === 0) {
113+
return <div>No slides to display</div>;
114+
}
115+
116+
return (
117+
<div
118+
className={styles.carousel}
119+
onMouseEnter={handleMouseEnter}
120+
onMouseLeave={handleMouseLeave}
121+
>
122+
<div className={styles.slidesWrapper}>
123+
<div
124+
className={styles.slidesContainer}
125+
style={{
126+
transform: `translateX(-${currentSlide * slideWidth}%)`,
127+
}}
128+
>
129+
{slides.map((slide, index) => (
130+
<div
131+
key={`carousel-slide-${index}`}
132+
className={styles.slide}
133+
style={{ minWidth: `${slideWidth}%` }}
134+
>
135+
{slide}
136+
</div>
137+
))}
138+
</div>
139+
</div>
140+
141+
<button
142+
className={clsx(styles.chevron, styles.chevronLeft)}
143+
onClick={goToPrevious}
144+
aria-label="Previous slide"
145+
>
146+
<ChevronLeftIcon size={40} />
147+
</button>
148+
149+
<button
150+
className={clsx(styles.chevron, styles.chevronRight)}
151+
onClick={goToNext}
152+
aria-label="Next slide"
153+
>
154+
<ChevronRightIcon size={40} />
155+
</button>
156+
157+
<div className={styles.pagination}>
158+
{new Array(slidesPages).fill(null).map((_, index) => (
159+
<button
160+
key={index}
161+
className={clsx(styles.dot, currentSlide === index && styles.dotActive)}
162+
onClick={() => goToSlide(index)}
163+
aria-label={`Go to slide ${index + 1}`}
164+
/>
165+
))}
166+
</div>
167+
</div>
168+
);
169+
};
170+
171+
export default Carousel;
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.carousel {
2+
position: relative;
3+
padding: 0 2rem;
4+
5+
.slidesWrapper {
6+
overflow: hidden;
7+
}
8+
9+
.slidesContainer {
10+
display: flex;
11+
transition: transform 0.5s ease-in-out;
12+
13+
.slide {
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
padding: 0 1rem;
18+
}
19+
}
20+
}
21+
22+
.chevron {
23+
position: absolute;
24+
top: 50%;
25+
transform: translateY(-50%);
26+
background-color: transparent;
27+
border: none;
28+
width: 30px;
29+
height: 30px;
30+
display: flex;
31+
align-items: center;
32+
justify-content: center;
33+
cursor: pointer;
34+
transition: all 0.3s ease;
35+
z-index: 2;
36+
color: white;
37+
padding: 0;
38+
}
39+
40+
.chevronLeft {
41+
left: 0px;
42+
}
43+
44+
.chevronRight {
45+
right: 0px;
46+
}
47+
48+
.pagination {
49+
display: flex;
50+
justify-content: center;
51+
gap: 8px;
52+
padding-bottom: 5px;
53+
54+
.dot {
55+
padding: 0;
56+
width: 8px;
57+
height: 8px;
58+
border-radius: 50%;
59+
border: none;
60+
cursor: pointer;
61+
transition: all 0.3s ease;
62+
opacity: 0.5;
63+
}
64+
65+
.dotActive {
66+
opacity: 1;
67+
transform: scale(1.3);
68+
}
69+
}

site/src/components/GoToLink/explore-code-samples.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

site/src/components/GoToLink/go-to-documentation.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)