import { Button, Tab } from '@fluid-design/fluid-ui'; import { AnimatePresence, motion, useInView, useReducedMotion, useScroll, useTransform, } from 'framer-motion'; import { useEffect, useRef, useState } from 'react'; import { HiOutlineMail, HiPause, HiPlay } from 'react-icons/hi'; import { MdSend } from 'react-icons/md'; import { Navigation, Pagination } from 'swiper'; import { Swiper, SwiperSlide } from 'swiper/react'; import { getNextItem, getPrevItem } from '@/lib/arrayHelpers'; import clsxm from '@/lib/clsxm'; import { Card } from '@/components/framework/Card'; import { DynamicImage } from '@/components/framework/DynamicImage'; import UnstyledLink from '@/components/framework/UnstyledLink'; import VideoPlayer from '@/components/VideoPlayer'; import a11yDark from '~/assets/index/a11y-dark.webp'; import a11yLight from '~/assets/index/a11y-light.webp'; import designConceptDark from '~/assets/index/design-concept-dark.webp'; import designConceptLight from '~/assets/index/design-concept-light.webp'; import webMoveForwardDark from '~/assets/index/web-forward-dark.webp'; import webMoveForwardLight from '~/assets/index/web-forward-light.webp'; export const FluidDesign = () => { const shouldReduceMotion = useReducedMotion(); const animationContainerRef = useRef(null); const [activeTabIndex, setActiveTabIndex] = useState(0); const [playAnimation, setPlayAnimation] = useState(false); const [activeCompIndex, setActiveCompIndex] = useState(0); const isAnimationInView = useInView(animationContainerRef); const overScrollRef = useRef(null); const { scrollX } = useScroll({ container: overScrollRef }); const conceptOpacity = useTransform(scrollX, [20, 30], [0, 1]); const elegantDesignVideos = [ { title: 'Fluid Design', description: 'Beautiful UI that are responsive, supports features like dark mode and a11y with elegant transitions.', acitveClassName: 'aspect-square', }, { title: 'Input Component', description: 'Clean input fields with validation and error states.', }, { title: 'Menu Component', description: 'Menu component supports keyboard navigation and screen readers.', }, ]; const intergrateCompList = [ 'Accordion', 'Button', 'Switch', 'Menu', 'Form', 'Input', 'Textarea', 'Combobox', ]; // play animation when in view, pause when out of view, always play when reduced motion useEffect(() => { if (!shouldReduceMotion) { if (isAnimationInView) { setPlayAnimation(true); } else { setPlayAnimation(false); } } }, [isAnimationInView, shouldReduceMotion]); useEffect(() => { // auto change tab index every 3 seconds, stops if user is hovering over tabs // total 3 tabs const interval = setInterval(() => { if (shouldReduceMotion) { return; } setActiveTabIndex((prev) => { if (prev === 2) { return 0; } return prev + 1; }); setActiveCompIndex((prev) => { const next = getNextItem(intergrateCompList, prev); return intergrateCompList.indexOf(next); }); }, 3800); return () => clearInterval(interval); }, []); return ( <>

Elegant Design

Many UI libraries and component designs often only focus on the looks. While they cover the majority of users' needs. Fluid Design aims to create components that works for all users, making extra effort to make beautiful design accessible.

{elegantDesignVideos.map((props, i) => ( ))}

Built with a11y in mind.

Utilizing libraries like{' '} headlessui {' '} to provide a11y features like focus management, keyboard navigation, and screen reader support. Fluid Design also adds support to high-contrast mode, reduce-motion, and light/dark mode.

Simple. But not simplistic.

In order to transform more websites into accessible websites, it is key to make the component intergration process as simple as possible. So anyone can adapt to it, even if they are not familiar with a11y. With no extra effort, you can create a beautiful and accessible website.

Normal High Contrast RTL

It all starts with
a simple idea.

The web is a powerful medium for communication and data exchange. However, not every website is created equal for every user. Some websites are difficult to use, and some are inaccessible to users with disabilities. Fluid Design is a set of tools that helps you build websites that are accessible, usable, and user-friendly.

Component

Packed with features

To design a beautiful resuable a11y component, it must be refined not only on the surface, but also under the hood. For example, a component can have states such as hover, focus, and active. It can also have different sizes, colors, weights and corner radius. It can also have disabled, loading, and error states. In addtion, it can have different variants such as outlined, ghost, and link, icons, orientation, cursor or pointer types... All of these needs to have a dark mode version as well. Not to mention the accessibility features that needed to be implemented.

Transitions

Transitions are not just to make the component look pretty. They serves a purpose to help the user understand the state of the component. It also directs the user's attention without needing to add additional context. Fluid Design uses mordern spring animation techniques to create smooth and performant transitions.

Linear

{playAnimation ? ( ) : ( )}

Ease In Out

{playAnimation ? ( ) : ( )}

Spring

{playAnimation ? ( ) : ( )}
import {'{'} {intergrateCompList[activeCompIndex]} {getPrevItem(intergrateCompList, activeCompIndex, 1)} {getPrevItem(intergrateCompList, activeCompIndex)} {getNextItem(intergrateCompList, activeCompIndex)} {getNextItem(intergrateCompList, activeCompIndex, 1)} {'}'} from '...' ;

Effortless intergration

Fluid Design is designed to be used with any React project. The components are made to be as customizable as possible. It handles a11y by default, so you can use the components as is - with little or no required props, or you can customize them, add refs, changing the wrapper type to fit your needs.

Aims to move the web
forward with a11y.

It's an ambitious goal, but it's one that we believe is possible. We believe that by pre-pack all these features and deliver to developers in a simple and easy to use package, we can help move the web forward with a11y.

); }; const SimpleButtonWrap = ({ className = '', children, ...props }) => (
{children}
);