-
Notifications
You must be signed in to change notification settings - Fork 1
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
Checkbox #23
base: master
Are you sure you want to change the base?
Conversation
S-unya
commented
Nov 28, 2022
- Create new AerCheckbox component
- Update some patterns in the other components
- Update templates
- Create docs/ remove docs
- Removed some unused files
…omponent-library into update-packaging
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.
QUERY: Are we planning on adding ESLint/prettier to this repo?
SAND: export { applyTheme } from "./Theme";
needs removing from src/index.tsx
It might be nice (if we have time) make a small example repo that sits alongside this project.
No show stoppers. 👍 PRs are always a negative process by default, picking holes in other peoples work. Great to see a lot of gotchas have been dealt with already. Great start. Thanks S'unya!
@@ -0,0 +1,90 @@ | |||
import React, { ForwardedRef, forwardRef, ReactElement } from "react"; |
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.
QUERY: Are we calling our component Dialog
rather than Dialogue
?
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.
src/main.tsx
Outdated
import { | ||
AerAlertDialog, | ||
AerAlertDialogFooter, | ||
AerAlertDialogTrigger, |
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.
PEBBLE: No exported member.
|
||
// Official docs suggest the non-null assertion | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const root = createRoot(container!); |
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.
SAND: I guess you don't need the disable rule and the bang?
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.
The disable rule is because we are adding the !
, which asserts that the element exists (even though it is possibly undefined)
throw new Error( | ||
"use{{pascalCase name}} must be used within an {{pascalCase name}}Provider" | ||
); | ||
} |
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.
PEBBLE: Formatting is a bit off here, and above.
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.
Yes, there is no good formatter for these templates. Once the code has generated and you hit save, it will all fix itself
@@ -0,0 +1,341 @@ | |||
/*! |
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.
❤️
@@ -1,14 +1,15 @@ | |||
import React, { HTMLAttributes } from "react"; | |||
import * as yup from "yup"; | |||
import { useForm, SubmitHandler } from "react-hook-form"; | |||
import { yupResolver } from "@hookform/resolvers"; | |||
import { yupResolver } from "@hookform/resolvers/yup"; | |||
import cx from "classnames"; | |||
|
|||
import { FormContext } from "./useFormContext"; | |||
|
|||
import styles from "./Form.module.scss"; | |||
import { UnpackNestedValue } from "react-hook-form/dist/types/form"; |
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.
SAND: Not being used.
const [defaultValues, setDefaultValues] = React.useState< | ||
UnpackNestedValue<DeepPartial<T>> | ||
>(); | ||
const [defaultValues, setDefaultValues] = React.useState<T>(); | ||
|
||
const methods = useForm<T>({ | ||
resolver: yupResolver(wrappedValidationSchema), |
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.
SAND: Typo on initial
below
|
||
.indicator { | ||
position: relative; | ||
color: var(--c-cmp-checbox-icon, currentColor); |
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.
PEBBLE: Typo checbox
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.
👍 fixed
font-size: var(--t-cmp-checkbox, var(--c-body-m)); | ||
} | ||
|
||
.invalid { |
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.
QUERY: could this be combined with .errorMessage
?
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.
They may want to be different colours, they just happen to be the same at the moment
const resolveNextState = ( | ||
currentState: CheckedStates, | ||
checked: CheckedStates | ||
) => (checked === "indeterminate" ? "indeterminate" : !currentState); |
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.
QUERY: Does the state of indeterminate
cover a loading state for this component? If not, is it worth exploring adding a loading state?
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.
:shrugging: I'm not sure. I can't really see why a checkbox should be in a loading state... but let's call YAGNI on it and add it if it is ever needed.