Skip to content

Commit 39dffb3

Browse files
committed
Refactor ServiceCard styles and fix optional chaining issue in Controller.
1 parent 62aafb3 commit 39dffb3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

example/src/components/examples/ServiceCarousel/ServiceCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const ServiceCard = ({
2525
desc,
2626
isActive,
2727
}: IProps) => {
28-
return <ServiceCardRoot className={className} isActive={isActive}>
28+
return <ServiceCardRoot className={className} $isActive={isActive}>
2929
<ServiceIcon>
3030
<img src={asset('/images/service_carousel/union.svg')} width="50" height="50"/>
3131
</ServiceIcon>
@@ -73,7 +73,7 @@ const ServiceIcon = styled.div`
7373
`;
7474

7575
const ServiceCardRoot = styled.div<{
76-
isActive: boolean,
76+
$isActive: boolean,
7777
}>`
7878
width: 100%;
7979
padding: 50px 30px;
@@ -106,7 +106,7 @@ const ServiceCardRoot = styled.div<{
106106
}
107107
108108
109-
${props => props.isActive && css`
109+
${props => props.$isActive && css`
110110
.text{
111111
color: transparent;
112112
}

src/manager/Controller/Controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Controller {
6666

6767
const {virtual, formatElement} = this._stater;
6868

69-
const {height} = this._elState.getMoveDistance(formatElement[virtual.activeIndex].matchIndex);
69+
const {height} = this._elState.getMoveDistance(formatElement[virtual.activeIndex]?.matchIndex) ?? 0;
7070

7171
this._elState
7272
.transform({height}, false)

0 commit comments

Comments
 (0)