-
Notifications
You must be signed in to change notification settings - Fork 9
adding loading component #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/components/loading/Loading.tsx
Outdated
| const Loading: React.FC<Props> = ({ text, ...rest }: Props) => ( | ||
| <div {...rest}> | ||
| <div className="nhsuk-loader__container"> | ||
| <p className="nhsuk-heading-l">{text}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want to render this element if no text prop is supplied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of just using a default value of "Loading..." if text isn't supplied, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant more of an empty string - so if someone wanted to disable the text entirely it wouldn't render an empty <p> tag (which I think can fail some Jest-axe tests but that might only be headers)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i'll have it check for the text being non-empty 👍
On that note, do you think it's worth adding a withoutText boolean prop for removing the text entirely? Seems like it'd be more intuitive than supplying an empty string to get around the default behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe allow for similar handling to errors in some components - i.e. allow for the type of text to be string | false and then check for false, and otherwise display any text passed in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/components/loading/_Loading.scss
Outdated
|
|
||
| .nhsuk-loader { | ||
| pointer-events: none; | ||
| width: 2.5em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be specifying the width on the .nhsuk-loader itself? The only way a user would be able to change the size of the spinner would be to directly override the .nhsuk-loader class. Would it be better to ensure that this element takes up 100% of it's container, then set the sizing on the container itself?
PR to add a loading component created as part of Cervical Screening platform.