Merge pull request #49 from TiE23/ISSUE-047
ISSUE-047 - Exported animated versions of a pair of styled-components…
This commit is contained in:
4 files changed
+13
-7
No files matched your search
@@ -1,10 +1,10 @@
|
|||||||
import { animated, useSpring } from "@react-spring/web";
|
import { useSpring } from "@react-spring/web";
|
||||||
import { useDrag } from "@use-gesture/react";
|
import { useDrag } from "@use-gesture/react";
|
||||||
import useMeasure from "react-use-measure";
|
import useMeasure from "react-use-measure";
|
||||||
import { clamp } from "lodash";
|
import { clamp } from "lodash";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ProgressSliderBar,
|
AnimatedProgressSliderBar,
|
||||||
ProgressSliderBarHandle,
|
ProgressSliderBarHandle,
|
||||||
ProgressSliderBarIndicator,
|
ProgressSliderBarIndicator,
|
||||||
ProgressSliderBody,
|
ProgressSliderBody,
|
||||||
@@ -55,8 +55,6 @@ export function ProgressSlider({
|
|||||||
onChange(newValue);
|
onChange(newValue);
|
||||||
}, { enabled: !disabled });
|
}, { enabled: !disabled });
|
||||||
|
|
||||||
const AnimatedProgressSliderBar = animated(ProgressSliderBar);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProgressSliderBody ref={bodyRef}>
|
<ProgressSliderBody ref={bodyRef}>
|
||||||
<AnimatedProgressSliderBar
|
<AnimatedProgressSliderBar
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { animated } from "@react-spring/web";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
export const ProgressSliderBody = styled.div`
|
export const ProgressSliderBody = styled.div`
|
||||||
@@ -33,6 +34,9 @@ export const ProgressSliderBar = styled.div<ProgressSliderBarProps>`
|
|||||||
`;
|
`;
|
||||||
ProgressSliderBar.displayName = "ProgressSliderBar";
|
ProgressSliderBar.displayName = "ProgressSliderBar";
|
||||||
|
|
||||||
|
export const AnimatedProgressSliderBar = animated(ProgressSliderBar);
|
||||||
|
AnimatedProgressSliderBar.displayName = "AnimatedProgressSliderBar";
|
||||||
|
|
||||||
type ProgressSliderBarHandleProps = {
|
type ProgressSliderBarHandleProps = {
|
||||||
color?: string,
|
color?: string,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { animated, useSpringRef, useTransition } from "@react-spring/web";
|
import { useSpringRef, useTransition } from "@react-spring/web";
|
||||||
|
|
||||||
import { findPrefixCount } from "../../../../utils/strings";
|
import { findPrefixCount } from "../../../../utils/strings";
|
||||||
import { SelectorLabel, SlotText, SlotWindow } from "./styles";
|
import { SelectorLabel, AnimatedSlotText, SlotWindow } from "./styles";
|
||||||
import { Inline } from "@bedrock-layout/inline";
|
import { Inline } from "@bedrock-layout/inline";
|
||||||
|
|
||||||
type SlotSelectorProps = {
|
type SlotSelectorProps = {
|
||||||
@@ -78,7 +78,7 @@ export function SlotSelector({
|
|||||||
)}
|
)}
|
||||||
<SlotWindow onClick={onClick} disabled={disabled} width={slotWidth}>
|
<SlotWindow onClick={onClick} disabled={disabled} width={slotWidth}>
|
||||||
{transitions((style, i) => (
|
{transitions((style, i) => (
|
||||||
<SlotText as={animated.span} style={style}>{getItem(i)}</SlotText>
|
<AnimatedSlotText style={style}>{getItem(i)}</AnimatedSlotText>
|
||||||
))}
|
))}
|
||||||
</SlotWindow>
|
</SlotWindow>
|
||||||
</Inline>
|
</Inline>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { animated } from "@react-spring/web";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
type SlotWindowProps = {
|
type SlotWindowProps = {
|
||||||
@@ -35,6 +36,9 @@ export const SlotText = styled.span`
|
|||||||
`;
|
`;
|
||||||
SlotText.displayName = "SlotText";
|
SlotText.displayName = "SlotText";
|
||||||
|
|
||||||
|
export const AnimatedSlotText = animated(SlotText);
|
||||||
|
AnimatedSlotText.displayName = "AnimatedSlotText";
|
||||||
|
|
||||||
export const SelectorLabel = styled.span`
|
export const SelectorLabel = styled.span`
|
||||||
font-family: ${p => p.theme.fonts.f1Regular};
|
font-family: ${p => p.theme.fonts.f1Regular};
|
||||||
font-size: ${p => p.theme.fontSizes.label};
|
font-size: ${p => p.theme.fontSizes.label};
|
||||||
|
|||||||
Reference in new issue
Block a user