Skip to content

Commit

Permalink
TP-1264-unify-loading-screens (#135)
Browse files Browse the repository at this point in the history
* TP-1264-unify-loading-screens
Add new loading screen to two forms to match new loading screen in Hosted Pages
  • Loading branch information
sharlotta93 authored Mar 21, 2024
1 parent 096ccc5 commit 6ca2d7f
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@awell-health/ui-library",
"version": "0.1.50",
"version": "0.1.51",
"private": false,
"description": "UI components to integrate with Awell Health",
"repository": {
Expand Down
9 changes: 6 additions & 3 deletions src/hostedPages/activities/form/ConversationalForm.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React, { useEffect } from 'react'
import { Button, ProgressIndicator, HorizontalSpinner } from '../../../atoms'
import { Button, ProgressIndicator } from '../../../atoms'
import classes from './form.module.scss'
import { Question as QuestionComponent } from '../../../molecules'
import { HostedPageFooter } from '../../layouts/HostedPageLayout/HostedPageFooter'
import { useScrollHint } from '../../../hooks/useScrollHint'
import layoutClasses from '../../layouts/HostedPageLayout/hostedPageLayout.module.scss'
import { FormProps } from '../../../types/form'
import { useConversationalForm } from '../../../hooks'
import { Question, UserQuestionType } from '../../../types'
import {
LoadActivityPlaceholder,
HostedPageFooter,
} from '../../layouts/HostedPageLayout'

export const ConversationalForm = ({
form,
Expand Down Expand Up @@ -97,7 +100,7 @@ export const ConversationalForm = ({
{isEvaluatingQuestionVisibility ||
currentQuestion?.id === undefined ? (
<div className={classes.loadingContainer}>
<HorizontalSpinner />
<LoadActivityPlaceholder />
</div>
) : (
<>
Expand Down
9 changes: 6 additions & 3 deletions src/hostedPages/activities/form/TraditionalForm.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React, { useEffect } from 'react'
import { Button, HorizontalSpinner, Text } from '../../../atoms'
import { Button, Text } from '../../../atoms'
import classes from './form.module.scss'
import { Question } from '../../../molecules'
import { useTraditionalForm } from '../../../hooks/useForm'
import layoutClasses from '../../layouts/HostedPageLayout/hostedPageLayout.module.scss'
import { FormProps } from '../../../types/form'
import { UserQuestionType } from '../../../types'
import { HostedPageFooter } from '../../layouts/HostedPageLayout/HostedPageFooter'
import { useTheme } from '../../../atoms/themeProvider/ThemeProvider'
import {
LoadActivityPlaceholder,
HostedPageFooter,
} from '../../layouts/HostedPageLayout'

export const TraditionalForm = ({
form,
Expand Down Expand Up @@ -59,7 +62,7 @@ export const TraditionalForm = ({
>
{!questionWithVisiblity ? (
<div className={classes.loadingContainer}>
<HorizontalSpinner />
<LoadActivityPlaceholder />
</div>
) : (
<div>
Expand Down
1 change: 1 addition & 0 deletions src/hostedPages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export { CloudinaryUpload } from './activities/cloudinary'
export { CloudinarySingleFileUpload } from './activities/cloudinary'
export { HostedPageLayout } from './layouts/HostedPageLayout'
export { CloseButton } from './layouts/HostedPageLayout'
export { LoadActivityPlaceholder } from './layouts/HostedPageLayout/LoadActivityPlaceholder'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import classes from './loadActivityPlaceholder.module.scss'
import React, { FC } from 'react'

export const LoadActivityPlaceholder: FC = (): JSX.Element => {
return (
<div className={classes.loading_indicators}>
<div className={classes.loading_indicator}></div>
<div className={classes.loading_indicator}></div>
<div className={classes.loading_indicator}></div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { LoadActivityPlaceholder } from './LoadActivityPlaceholder'
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@use '../../../../globalStyles';

.loading_indicators {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}

.loading_indicator {
width: 100%;
height: 3.125rem;
border-radius: var(--awell-border-radius-xl);
margin: var(--awell-spacing-2) 0;
background: linear-gradient(90deg, transparent, #EEEEEE, transparent);
background-size: 200% 100%;
background-position: -100% 0;
animation: wave 1.2s infinite;
}

/* Styles for larger screens */
@media (min-width: 768px) {
.loading_indicators {
max-width: 570px;
padding: var(--awell-spacing-8) 0;
}
}

/* Styles for smaller screens (mobile) */
@media (max-width: 767px) {
.loading_indicators {
min-width: 336px;
padding: var(--awell-spacing-8) var(--awell-spacing-4);
}
}

@keyframes wave {
0% {
background-position: -100% 0;
}
100% {
background-position: 100% 0;
}
}

2 changes: 2 additions & 0 deletions src/hostedPages/layouts/HostedPageLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { HostedPageLayout } from './HostedPageLayout'
export { CloseButton } from './CloseButton'
export { LoadActivityPlaceholder } from './LoadActivityPlaceholder'
export { HostedPageFooter } from './HostedPageFooter'

0 comments on commit 6ca2d7f

Please sign in to comment.