Skip to content

Commit

Permalink
fix: #105 fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
dannd committed Feb 1, 2020
1 parent 0afcb0b commit 722dc1a
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/elements/src/components/HelpGuide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ export const caculateStepChange = ({
helpguideRef: React.RefObject<HTMLElement>
isMobileScreen: boolean
}) => () => {
if (currentStepRef.current && wrapperStepRef.current && helpguideRef.current) {
if (isMobileScreen) {
helpguideRef.current.style.height = '100%'
wrapperStepRef.current.style.transform = `translate3d(-${currentStepRef.current.offsetLeft}px, 0, 0)`
} else {
helpguideRef.current.style.height = `${currentStepRef.current.offsetHeight}px`
wrapperStepRef.current.style.transform = `translate3d(0, -${currentStepRef.current.offsetTop}px, 0)`
}
if (currentStepRef.current && wrapperStepRef.current && helpguideRef.current && isMobileScreen) {
helpguideRef.current.style.height = '100%'
wrapperStepRef.current.style.transform = `translate3d(-${currentStepRef.current.offsetLeft}px, 0, 0)`
}

if (currentStepRef.current && wrapperStepRef.current && helpguideRef.current && !isMobileScreen) {
helpguideRef.current.style.height = `${currentStepRef.current.offsetHeight}px`
wrapperStepRef.current.style.transform = `translate3d(0, -${currentStepRef.current.offsetTop}px, 0)`
}
}

Expand All @@ -62,13 +62,12 @@ export const caculateWrapperWith = ({
total: number
isMobileScreen: boolean
}) => () => {
if (helpguideRef.current && wrapperStepRef.current) {
if (isMobileScreen) {
const wrapperWidth = helpguideRef.current.clientWidth * total
wrapperStepRef.current.style.width = `${wrapperWidth}px`
} else {
wrapperStepRef.current.style.width = '100%'
}
if (helpguideRef.current && wrapperStepRef.current && isMobileScreen) {
const wrapperWidth = helpguideRef.current.clientWidth * total
wrapperStepRef.current.style.width = `${wrapperWidth}px`
}
if (helpguideRef.current && wrapperStepRef.current && !isMobileScreen) {
wrapperStepRef.current.style.width = '100%'
}
}

Expand Down

0 comments on commit 722dc1a

Please sign in to comment.