Skip to content
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

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open

Checkbox #23

wants to merge 47 commits into from

Conversation

S-unya
Copy link
Member

@S-unya 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

C0deJack
C0deJack previously approved these changes Nov 29, 2022
Copy link

@C0deJack C0deJack left a 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";

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 ?

Copy link
Member Author

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,

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!);

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?

Copy link
Member Author

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"
);
}

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.

Copy link
Member Author

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 @@
/*!

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";

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),

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEBBLE: Typo checbox

Copy link
Member Author

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 {

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 ?

Copy link
Member Author

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);

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?

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants