-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: add Callout component #240
Conversation
// @ts-expect-error - Callout does not accept `role` | ||
<Callout variant="success" role="alert"> | ||
Hello World | ||
</Callout>; | ||
|
||
// @ts-expect-error - Callout does not accept `role` | ||
<Callout variant="info" role="alert"> | ||
Hello World | ||
</Callout>; | ||
|
||
// @ts-expect-error - Callout does not accept `role` | ||
<Callout variant="warning" role="alert"> | ||
Hello World | ||
</Callout>; | ||
|
||
// @ts-expect-error - Callout does not accept `role` | ||
<Callout variant="danger" role="alert"> | ||
Hello World |
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.
These could use a description. ex. it('check something', ()=>
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.
So we have two types of test in here:
- Component functionality tests, which are in the
describe
/it
blocks and run with Jest - Type tests, which are to ensure non-allowed props aren't passed in. The tests are run by TypeScript compiler (technically TypeScript doesn't run any special tests, it does throw typecheck errors if we pass in the prohibited props, but
// @ts-expect-error
helps suppress the errors)
We can put these tests inside an it
block, but it's a little weird as the type tests aren't related / powered by Jest. Also, we can't write an assertion (in this case, I guess expect(...).toThrow()
) for the it
blocks because Jest doesn't know about the TS errors.
I added a comment next to each @ts-expect-error
, hopefully that makes the purpose of each type test a little more clear?
Looking great. The component could use a one pixel border with the same color as the font. |
You are right. Perhaps we could try a color with a low alpha value and see it looks. |
Checklist:
Update index.md
)This PR adds
Callout
component to the library (mentioned in #132).This
Callout
component allows us to use visual cue to draw users attention to important information, while not disrupting screen reader users workflow.Notes on the implementation:
Callout
component is visually identical toAlert
, but it doesn't have arole
attributeCallout
andAlert
as separate components, even though their implementation is almost the same.Callout
could have a different set ofvariant
, or it could have a title and/or an icon).Screenshot