11import React , { useRef } from "react" ;
2- import styled from "styled-components" ;
2+ import styled , { css , keyframes } from "styled-components" ;
33import Spine , { VariantProp , variantColor } from "./spine" ;
44export type { VariantProp } ;
55import { h2 , p , small } from "../../../styles/common-style" ;
@@ -8,10 +8,40 @@ export interface SideProp {
88 rightSided ?: boolean ;
99}
1010
11- const Wrapper = styled . div < SideProp > `
11+ export interface StateProp {
12+ state ?: "loading" | "disabled" | "active" ;
13+ }
14+
15+ const loading = keyframes `
16+ 0%{
17+ opacity: 1;
18+ }
19+ 50%{
20+ opacity: 0.5;
21+ }
22+ 100%{
23+ opacity: 1;
24+ }
25+ ` ;
26+
27+ const Wrapper = styled . div < SideProp & StateProp > `
1228 display: flex;
29+ position: relative;
1330 justify-content: ${ ( { rightSided } ) =>
1431 rightSided ? "flex-start" : "flex-end" } ;
32+ ${ ( { state } ) => {
33+ if ( state === "disabled" )
34+ return css `
35+ opacity: 0.5;
36+ ` ;
37+ if ( state === "loading" )
38+ return css `
39+ animation: ${ loading } 2s ease-in-out infinite normal;
40+ ` ;
41+ return css `
42+ opacity: 1;
43+ ` ;
44+ } }
1545` ;
1646
1747const StyledTitle = styled . h2 `` ;
@@ -78,7 +108,7 @@ const PartyTitleContainer = styled.div<SideProp>`
78108 rightSided ? "flex-start" : "flex-end" } ;
79109` ;
80110
81- interface BulletProps extends VariantProp , SideProp {
111+ interface BulletProps extends VariantProp , SideProp , StateProp {
82112 title : string ;
83113 party : string | React . ReactElement ;
84114 subtitle : string ;
@@ -90,14 +120,17 @@ interface BulletProps extends VariantProp, SideProp {
90120
91121const Bullet : React . FC < BulletProps > = ( props ) => {
92122 const { title, party, subtitle, ...restProps } = props ;
93- const { rightSided, variant, line, Icon, isLast, ...wrapperProps } =
123+ const { rightSided, variant, line, Icon, isLast, state , ...wrapperProps } =
94124 restProps ;
95125 const titleRef = useRef < HTMLHeadingElement > ( null ) ;
96126
97127 return (
98- < Wrapper { ...{ rightSided } } { ...wrapperProps } >
128+ < Wrapper { ...{ rightSided, state } } { ...wrapperProps } >
99129 < Spine { ...{ variant, line, Icon, titleRef } } />
100- < TextContainer { ...{ variant, rightSided, isLast } } >
130+ < TextContainer
131+ className = "text-container"
132+ { ...{ variant, rightSided, isLast } }
133+ >
101134 < PartyTitleContainer { ...{ rightSided } } >
102135 < StyledTitle ref = { titleRef } > { title } </ StyledTitle >
103136 { typeof party === `string` ? (
0 commit comments