react-icons/bi#BiChevronLeft TypeScript Examples
The following examples show how to use
react-icons/bi#BiChevronLeft.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: onboarding.tsx From slice-machine with Apache License 2.0 | 4 votes |
export default function Onboarding(): JSX.Element {
const STEPS = [
<WelcomeSlide onClick={nextSlide} />,
<BuildSlicesSlide />,
<CreatePageTypesSlide />,
<PushPagesSlide />,
];
const { finishOnboarding } = useSliceMachineActions();
const [state, setState] = useState({
step: 0,
});
handleTracking({
...state,
maxSteps: STEPS.length,
});
const finish = () => {
finishOnboarding();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
router.push("/");
};
function nextSlide() {
if (state.step === STEPS.length - 1) return finish();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Tracker.get().trackOnboardingContinue(idFromStep(state.step));
return setState({ ...state, step: state.step + 1 });
}
function prevSlide() {
return setState({ ...state, step: state.step - 1 });
}
return (
<OnboardingGrid>
<Flex
sx={{
gridArea: "top-right",
alignItems: "center",
justifyContent: "end",
padding: "1em 4em",
}}
>
{!!state.step && (
<Button
variant="transparent"
onClick={finish}
data-cy="skip-onboarding"
title="skip onboarding"
tabIndex={0}
sx={{
color: "textClear",
}}
>
skip
</Button>
)}
</Flex>
{STEPS.map((Component, i) => (
<Flex
hidden={i !== state.step}
key={`step-${i + 1}`}
sx={{
gridArea: "content",
alignItems: "center",
justifyContent: "center",
alignContent: "center",
flexDirection: "column",
opacity: i === state.step ? "1" : "0",
pointerEvents: i === state.step ? "all" : "none",
transition: `opacity .2s ease-in`,
}}
>
{Component}
</Flex>
))}
<Flex
sx={{
gridArea: "footer",
alignItems: "start",
justifyContent: "center",
padingTop: "16px", // half height of a button
}}
>
{!!state.step && (
<StepIndicator current={state.step - 1} maxSteps={STEPS.length - 1} />
)}
</Flex>
<Flex
sx={{
gridArea: "footer-left",
alignItems: "start",
justifyContent: "space-around",
}}
>
{state.step >= 2 && (
<IconButton
tabIndex={0}
title="previous slide"
sx={{
width: "40px",
height: "40px",
borderRadius: "50%",
background: "#F1F1F4",
border: "1px solid rgba(62, 62, 72, 0.15)",
}}
onClick={prevSlide}
>
<BiChevronLeft />
</IconButton>
)}
</Flex>
<Flex
sx={{
gridArea: "footer-right",
alignItems: "start",
justifyContent: "end",
padding: "0em 4em",
}}
>
{!!state.step && (
<Button
data-cy="continue"
onClick={nextSlide}
title="continue"
tabIndex={0}
>
Continue
</Button>
)}
</Flex>
</OnboardingGrid>
);
}