-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: rename feature section to vision * refactor: move section shell to new component * feat: add background color variant and apply to sections * build(deps): add react-responsive-carousel * build(deps): add react-icons * feat: add features carousel * refactor: rename vision to concepts * refactor: update features descriptions
- Loading branch information
1 parent
ca6125b
commit b7be772
Showing
48 changed files
with
573 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import clsx from 'clsx'; | ||
import React, { FC } from 'react'; | ||
import { PiCaretLeftBold, PiCaretRightBold } from 'react-icons/pi'; | ||
import { Carousel as ReactResponsiveCarousel } from 'react-responsive-carousel'; | ||
|
||
// components | ||
import CarouselButton from './CarouselButton'; | ||
|
||
// styles | ||
import styles from './index.module.scss'; | ||
|
||
// types | ||
import { ICarouselItemProps } from './types'; | ||
|
||
interface IProps { | ||
items: ICarouselItemProps[]; | ||
} | ||
|
||
const Carousel: FC<IProps> = ({ items }: IProps) => { | ||
return ( | ||
<ReactResponsiveCarousel | ||
emulateTouch={true} | ||
renderArrowNext={( | ||
onClickHandler: () => void, | ||
hasNext: boolean, | ||
label: string | ||
) => { | ||
if (hasNext) { | ||
return ( | ||
<CarouselButton | ||
Icon={PiCaretRightBold} | ||
isPrev={false} | ||
onClick={onClickHandler} | ||
label={label} | ||
/> | ||
); | ||
} | ||
|
||
return null; | ||
}} | ||
renderArrowPrev={( | ||
onClickHandler: () => void, | ||
hasPrev: boolean, | ||
label: string | ||
) => { | ||
if (hasPrev) { | ||
return ( | ||
<CarouselButton | ||
Icon={PiCaretLeftBold} | ||
isPrev={true} | ||
onClick={onClickHandler} | ||
label={label} | ||
/> | ||
); | ||
} | ||
|
||
return null; | ||
}} | ||
renderIndicator={(onClickHandler, isSelected, index) => { | ||
const key: string = `carousel-indicator-item-${index}`; | ||
|
||
if (isSelected) { | ||
return ( | ||
<li | ||
aria-label={items[index].label} | ||
className={clsx(styles.indicator, styles['indicator--selected'])} | ||
key={key} | ||
title={items[index].label} | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<li | ||
aria-label={items[index].label} | ||
className={styles.indicator} | ||
onClick={onClickHandler} | ||
onKeyDown={onClickHandler} | ||
key={key} | ||
role="button" | ||
tabIndex={0} | ||
title={items[index].label} | ||
value={index} | ||
/> | ||
); | ||
}} | ||
showStatus={false} | ||
useKeyboardArrows={true} | ||
> | ||
{items.map(({ children }) => children)} | ||
</ReactResponsiveCarousel> | ||
); | ||
}; | ||
|
||
export default Carousel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import clsx from 'clsx'; | ||
import React, { FC } from 'react'; | ||
import { IconType } from 'react-icons'; | ||
|
||
// styles | ||
import styles from './index.module.scss'; | ||
|
||
interface IProps { | ||
Icon: IconType; | ||
isPrev: boolean; | ||
label: string; | ||
onClick: () => void; | ||
} | ||
|
||
const CarouselButton: FC<IProps> = ({ Icon, isPrev, onClick }: IProps) => { | ||
return ( | ||
<div | ||
className={clsx( | ||
styles.container, | ||
isPrev ? styles['container--previous'] : styles['container--next'] | ||
)} | ||
> | ||
<button className={styles.button} onClick={onClick}> | ||
<Icon className={styles.icon} /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CarouselButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.button { | ||
background: none; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.container { | ||
align-items: center; | ||
bottom: 0; | ||
display: flex; | ||
position: absolute; | ||
top: 0; | ||
z-index: 1; | ||
|
||
&--next { | ||
right: 0; | ||
} | ||
|
||
&--previous { | ||
left: 0; | ||
} | ||
} | ||
|
||
.icon { | ||
fill: var(--kb-text-color); | ||
height: 3rem; | ||
transition: color var(--ifm-transition-fast) var(--ifm-transition-timing-default); | ||
width: 3rem; | ||
|
||
&:hover { | ||
fill: var(--ifm-color-primary) | ||
} | ||
} | ||
|
||
.indicator { | ||
background: var(--ifm-color-primary); | ||
display: inline-block; | ||
filter: alpha(opacity=30); | ||
opacity: 0.3; | ||
//box-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9); | ||
border-radius: 50%; | ||
width: 8px; | ||
height: 8px; | ||
cursor: pointer; | ||
margin: 0 8px; | ||
transition: opacity .25s ease-in; | ||
|
||
&--selected, | ||
&:hover { | ||
filter: alpha(opacity=100); | ||
opacity: 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './Carousel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ReactElement } from 'react'; | ||
|
||
interface ICarouselItemProps { | ||
children: ReactElement; | ||
label?: string; | ||
} | ||
|
||
export default ICarouselItemProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as ICarouselItemProps } from './ICarouselItemProps'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default } from './ConceptsSection'; | ||
export { default as ConceptItem } from './ConceptItem'; | ||
export * from './types'; |
Oops, something went wrong.