diff --git a/src/lib/shared/hooks/index.ts b/src/lib/shared/hooks/index.ts deleted file mode 100644 index 62cedcf..0000000 --- a/src/lib/shared/hooks/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Экспорт хуков -export * from "./useRipple"; diff --git a/src/lib/shared/hooks/useRipple.ts b/src/lib/shared/hooks/useRipple.ts deleted file mode 100644 index 32230b9..0000000 --- a/src/lib/shared/hooks/useRipple.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { MouseEvent } from "react"; -import { useCallback, useState } from "react"; - -export const RIPPLE_SIZE = 100; - -export interface RippleProps { - x: number; - y: number; - key: number; -} - -/** - * Хук для управления эффектом Ripple. - * - * @returns {Object} Состояние и функции для управления Ripple - */ -export const useRipple = () => { - const [ripples, setRipples] = useState([]); - const [rippleKey, setRippleKey] = useState(0); - - /** - * Создание эффекта Ripple при клике. - * - * @param {MouseEvent} event Событие клика - */ - const createRipple = useCallback( - (event: MouseEvent) => { - const button = event.currentTarget; - const rect = button.getBoundingClientRect(); - const x = event.clientX - ? event.clientX - rect.left - RIPPLE_SIZE / 2 - : rect.width / 2 - RIPPLE_SIZE / 2; - const y = event.clientY - ? event.clientY - rect.top - RIPPLE_SIZE / 2 - : rect.height / 2 - RIPPLE_SIZE / 2; - const newRipple = { x, y, key: rippleKey }; - setRipples((prevRipples) => [...prevRipples, newRipple]); - setRippleKey((prevKey) => prevKey + 1); - }, - [rippleKey], - ); - - /** - * Удаление эффекта Ripple после завершения анимации. - * - * @param {number} key Ключ эффекта Ripple - */ - const handleAnimationEnd = useCallback((key: number) => { - setRipples((prevRipples) => - prevRipples.filter((ripple) => ripple.key !== key), - ); - }, []); - - return { - ripples, - createRipple, - handleAnimationEnd, - }; -}; diff --git a/src/lib/shared/types/colorSchemeTypes.ts b/src/lib/shared/types/colorSchemeTypes.ts index cf7de5b..3b1c382 100644 --- a/src/lib/shared/types/colorSchemeTypes.ts +++ b/src/lib/shared/types/colorSchemeTypes.ts @@ -2,7 +2,6 @@ export interface ColorSchemeState { backgroundColor: string; borderColor: string; textColor: string; - rippleColor: string; } export interface VariantColorSchemeConfig { diff --git a/src/lib/shared/ui/button/RippleContainer.tsx b/src/lib/shared/ui/button/RippleContainer.tsx deleted file mode 100644 index 238cb81..0000000 --- a/src/lib/shared/ui/button/RippleContainer.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { FC } from "react"; -import { RippleProps } from "../../hooks"; -import { ColorScheme, Variant } from "../../types"; -import { - RippleContainer as StyledRippleContainer, - Ripple, -} from "./styles/Ripple.styles"; - -interface RippleContainerProps { - ripples: RippleProps[]; - handleAnimationEnd: (key: number) => void; - rippleDuration?: string; - colorScheme: ColorScheme; - variant: Variant; -} - -export const RippleContainer: FC = ({ - ripples, - handleAnimationEnd, - rippleDuration = "0.6s", - colorScheme, - variant, -}) => { - return ( - - {ripples.map((ripple: RippleProps) => ( - handleAnimationEnd(ripple.key)} - /> - ))} - - ); -}; diff --git a/src/lib/shared/ui/button/stories/Button.stories.tsx b/src/lib/shared/ui/button/stories/Button.stories.tsx deleted file mode 100644 index 7140e8d..0000000 --- a/src/lib/shared/ui/button/stories/Button.stories.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { Meta } from "@storybook/react"; -import { BaseButton } from "../components/BaseButton"; -import "../../../styles/index"; - -export default { - title: "Buttons", -} as Meta; diff --git a/src/lib/shared/ui/button/styles/Ripple.styles.ts b/src/lib/shared/ui/button/styles/Ripple.styles.ts deleted file mode 100644 index 3cd70db..0000000 --- a/src/lib/shared/ui/button/styles/Ripple.styles.ts +++ /dev/null @@ -1,46 +0,0 @@ -import styled, { keyframes } from "styled-components"; -import { Variant, ColorScheme } from "../../../types/uiTypes"; -import { colorSchemeStyles } from "../../styles/colorSchemeStyles"; - -const rippleEffect = keyframes` - from { - transform: scale(0); - opacity: 1; - } - to { - transform: scale(6); - opacity: 0; - } -`; - -interface RippleProps { - x: number; - y: number; - duration?: string; - colorScheme: ColorScheme; - variant: Variant; -} - -export const Ripple = styled.span` - position: absolute; - border-radius: 50%; - background: ${({ colorScheme, variant }) => - colorSchemeStyles[variant][colorScheme].pressed.rippleColor}; - width: 100px; - height: 100px; - left: ${({ x }) => x}px; - top: ${({ y }) => y}px; - transform: scale(0); - animation: ${rippleEffect} ${({ duration }) => duration || "0.6s"} linear; - pointer-events: none; - z-index: 0; -`; - -export const RippleContainer = styled.div` - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - pointer-events: none; -`; diff --git a/src/lib/shared/ui/styles/containedColorSchemeStyles.ts b/src/lib/shared/ui/styles/containedColorSchemeStyles.ts index 89899e0..e800398 100644 --- a/src/lib/shared/ui/styles/containedColorSchemeStyles.ts +++ b/src/lib/shared/ui/styles/containedColorSchemeStyles.ts @@ -9,25 +9,21 @@ export const containedColorSchemeStyles: Record< backgroundColor: "#4E76FC", borderColor: "#4E76FC", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, hover: { backgroundColor: "#264ED2", borderColor: "#264ED2", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, pressed: { backgroundColor: "#4E76FC", borderColor: "#4E76FC", textColor: "#FFFFFF", - rippleColor: "rgba(255, 255, 255, 0.3)", }, disabled: { backgroundColor: "#f2f2f3", borderColor: "transparent", textColor: "#a2a4aa", - rippleColor: "transparent", }, }, secondary: { @@ -35,25 +31,21 @@ export const containedColorSchemeStyles: Record< backgroundColor: "#e4e5ed", borderColor: "#e4e5ed", textColor: "#4f5360", - rippleColor: "rgba(255, 255, 255, 0.3)", }, hover: { backgroundColor: "#d2d5e2", borderColor: "#d2d5e2", textColor: "#4f5360", - rippleColor: "rgba(255, 255, 255, 0.3)", }, pressed: { backgroundColor: "rgba(228, 229, 237, 0.08)", borderColor: "rgba(228, 229, 237, 0.5)", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, disabled: { backgroundColor: "#f2f2f3", borderColor: "transparent", textColor: "#a2a4aa", - rippleColor: "transparent", }, }, error: { @@ -61,25 +53,21 @@ export const containedColorSchemeStyles: Record< backgroundColor: "#E9433E", borderColor: "#E9433E", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, hover: { backgroundColor: "#BE3632", borderColor: "#BE3632", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, pressed: { backgroundColor: "rgba(233, 67, 62, 0.08)", borderColor: "rgba(233, 67, 62, 0.5)", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, disabled: { backgroundColor: "#f2f2f3", borderColor: "transparent", textColor: "#a2a4aa", - rippleColor: "transparent", }, }, warning: { @@ -87,25 +75,21 @@ export const containedColorSchemeStyles: Record< backgroundColor: "#FF6600", borderColor: "#FF6600", textColor: "#FFFFFF", - rippleColor: "rgba(255, 255, 255, 0.3)", }, hover: { backgroundColor: "#E25C02", borderColor: "#E25C02", textColor: "#FFFFFF", - rippleColor: "rgba(255, 255, 255, 0.3)", }, pressed: { backgroundColor: "rgba(255, 102, 0, 0.08)", borderColor: "rgba(255, 102, 0, 0.5)", textColor: "#FFFFFF", - rippleColor: "rgba(255, 102, 0, 0.3)", }, disabled: { backgroundColor: "#f2f2f3", borderColor: "transparent", textColor: "#a2a4aa", - rippleColor: "transparent", }, }, success: { @@ -113,25 +97,21 @@ export const containedColorSchemeStyles: Record< backgroundColor: "#268B61", borderColor: "#268B61", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, hover: { backgroundColor: "#226E50", borderColor: "#226E50", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, pressed: { backgroundColor: "rgba(38, 139, 97, 0.08)", borderColor: "rgba(38, 139, 97, 0.5)", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, disabled: { backgroundColor: "#f2f2f3", borderColor: "transparent", textColor: "#a2a4aa", - rippleColor: "transparent", }, }, info: { @@ -139,25 +119,21 @@ export const containedColorSchemeStyles: Record< backgroundColor: "#4E76FC", borderColor: "#4E76FC", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, hover: { backgroundColor: "#264ED2", borderColor: "#264ED2", textColor: "#ffffff", - rippleColor: "rgba(255, 255, 255, 0.3)", }, pressed: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "rgba(78, 118, 252, 0.5)", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, disabled: { backgroundColor: "#f2f2f3", borderColor: "transparent", textColor: "#a2a4aa", - rippleColor: "transparent", }, }, }; diff --git a/src/lib/shared/ui/styles/outlinedColorSchemeStyles.ts b/src/lib/shared/ui/styles/outlinedColorSchemeStyles.ts index 48ab72a..770bf92 100644 --- a/src/lib/shared/ui/styles/outlinedColorSchemeStyles.ts +++ b/src/lib/shared/ui/styles/outlinedColorSchemeStyles.ts @@ -9,25 +9,21 @@ export const outlinedColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "#4E76FC", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, hover: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "rgba(78, 118, 252, 0.5)", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, pressed: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "rgba(78, 118, 252, 0.5)", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "#676767", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, secondary: { @@ -35,25 +31,21 @@ export const outlinedColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "#e4e5ed", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, hover: { backgroundColor: "rgba(228, 229, 237, 0.08)", borderColor: "rgba(228, 229, 237, 0.5)", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, pressed: { backgroundColor: "rgba(228, 229, 237, 0.08)", borderColor: "rgba(228, 229, 237, 0.5)", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "#676767", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, error: { @@ -61,25 +53,21 @@ export const outlinedColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "#E9433E", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, hover: { backgroundColor: "rgba(233, 67, 62, 0.08)", borderColor: "rgba(233, 67, 62, 0.5)", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, pressed: { backgroundColor: "rgba(233, 67, 62, 0.08)", borderColor: "rgba(233, 67, 62, 0.5)", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "#676767", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, warning: { @@ -87,25 +75,21 @@ export const outlinedColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "#FF6600", textColor: "#FF6600", - rippleColor: "rgba(255, 102, 0, 0.3)", }, hover: { backgroundColor: "rgba(255, 102, 0, 0.08)", borderColor: "rgba(255, 102, 0, 0.5)", textColor: "#FF6600", - rippleColor: "rgba(255, 102, 0, 0.3)", }, pressed: { backgroundColor: "rgba(255, 102, 0, 0.08)", borderColor: "rgba(255, 102, 0, 0.5)", textColor: "#FF6600", - rippleColor: "rgba(255, 102, 0, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "#676767", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, success: { @@ -113,25 +97,21 @@ export const outlinedColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "#268B61", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, hover: { backgroundColor: "rgba(38, 139, 97, 0.08)", borderColor: "rgba(38, 139, 97, 0.5)", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, pressed: { backgroundColor: "rgba(38, 139, 97, 0.08)", borderColor: "rgba(38, 139, 97, 0.5)", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "#676767", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, info: { @@ -139,25 +119,21 @@ export const outlinedColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "#4E76FC", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, hover: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "rgba(78, 118, 252, 0.5)", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, pressed: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "rgba(78, 118, 252, 0.5)", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "#676767", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, }; diff --git a/src/lib/shared/ui/styles/textColorSchemeStyles.ts b/src/lib/shared/ui/styles/textColorSchemeStyles.ts index d3d41ca..825b6ac 100644 --- a/src/lib/shared/ui/styles/textColorSchemeStyles.ts +++ b/src/lib/shared/ui/styles/textColorSchemeStyles.ts @@ -9,25 +9,21 @@ export const textColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "transparent", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, hover: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "transparent", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, pressed: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "transparent", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "transparent", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, secondary: { @@ -35,25 +31,21 @@ export const textColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "transparent", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, hover: { backgroundColor: "rgba(228, 229, 237, 0.08)", borderColor: "transparent", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, pressed: { backgroundColor: "rgba(228, 229, 237, 0.08)", borderColor: "transparent", textColor: "#4f5360", - rippleColor: "rgba(228, 229, 237, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "transparent", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, error: { @@ -61,25 +53,21 @@ export const textColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "transparent", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, hover: { backgroundColor: "rgba(233, 67, 62, 0.08)", borderColor: "transparent", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, pressed: { backgroundColor: "rgba(233, 67, 62, 0.08)", borderColor: "transparent", textColor: "#E9433E", - rippleColor: "rgba(233, 67, 62, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "transparent", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, warning: { @@ -87,25 +75,21 @@ export const textColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "transparent", textColor: "#FF6600", - rippleColor: "rgba(255, 102, 0, 0.3)", }, hover: { backgroundColor: "rgba(255, 102, 0, 0.08)", borderColor: "transparent", textColor: "#FF6600", - rippleColor: "rgba(255, 102, 0, 0.3)", }, pressed: { backgroundColor: "rgba(255, 102, 0, 0.08)", borderColor: "transparent", textColor: "#FF6600", - rippleColor: "rgba(255, 102, 0, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "transparent", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, success: { @@ -113,25 +97,21 @@ export const textColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "transparent", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, hover: { backgroundColor: "rgba(38, 139, 97, 0.08)", borderColor: "transparent", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, pressed: { backgroundColor: "rgba(38, 139, 97, 0.08)", borderColor: "transparent", textColor: "#268B61", - rippleColor: "rgba(38, 139, 97, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "transparent", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, info: { @@ -139,25 +119,21 @@ export const textColorSchemeStyles: Record< backgroundColor: "transparent", borderColor: "transparent", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, hover: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "transparent", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, pressed: { backgroundColor: "rgba(78, 118, 252, 0.08)", borderColor: "transparent", textColor: "#4E76FC", - rippleColor: "rgba(78, 118, 252, 0.3)", }, disabled: { backgroundColor: "#d4d4d4", borderColor: "transparent", textColor: "#727272", - rippleColor: "rgba(255, 255, 255, 0.3)", }, }, };