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

implement lettercase feature #2461

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

RED-ROSE515
Copy link
Contributor

@RED-ROSE515 RED-ROSE515 commented Oct 17, 2024

#2424

I implemented lettercase features( LowerCase, UpperCase, SentenceCase, TitleCase) to the ToolBar.

These are the screenshots.
image
image
image
image

Copy link
Contributor

@raineorshine raineorshine left a comment

Choose a reason for hiding this comment

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

Thank you! This is a great stat. Thanks for adding a unit test as well.

Please always reference the associated issue number in the PR description. That way GitHub will link the PR to the issue. I've added it above.

It looks like the Linter, Tests, and Puppeteer tests are all failing in the CI. Once these are all passing I can do a proper review.

I will note that useWindowOverlay has been duplicated in the ColorPicker and LetterCasePicker component. As mentioned in the issue, and following the DRY principle, we want to avoid code duplication. Code duplication doubles the amount of code to maintain and leads to subtle discrepancies over time. Instead, factor out the common code and use the appropriate level of abstraction to share common functionality.

Copy link
Contributor

@raineorshine raineorshine left a comment

Choose a reason for hiding this comment

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

Thank you! Looks very good. I've offered some tips below to clean up the code a bit.

There are just a couple behavioral issues I am seeing:

  1. Let's prevent both the ColorPicker dropdown and the LetterCase dropdown from being open at the same time. If one is clicked, the other one should close.
  2. The browser selection (i.e. text cursor) is not being preserved when it starts at the end of the thought. I'm guessing that selection.restore does not work in this case because savedSelection.node is not the same after the thought re-renders.

.prettierrc.json Outdated Show resolved Hide resolved
src/@types/State.ts Outdated Show resolved Hide resolved
src/shortcuts/lettercase.ts Outdated Show resolved Hide resolved
src/actions/formatLetterCase.ts Outdated Show resolved Hide resolved
src/actions/formatLetterCase.ts Outdated Show resolved Hide resolved
src/shortcuts/lettercase.ts Outdated Show resolved Hide resolved
src/components/__tests__/LetterCasePicker.ts Outdated Show resolved Hide resolved
src/components/LetterCasePicker.tsx Outdated Show resolved Hide resolved
<div style={{ userSelect: 'none' }}>
<div
ref={ref}
style={{
Copy link
Contributor

Choose a reason for hiding this comment

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

This project uses PandaCSS for styling. The style attribute should only be used for styles with dynamic runtime values. Otherwise you should use Panda's css function. See other components for usage, or check out https://panda-css.com/docs/concepts/writing-styles.

src/actions/formatLetterCase.ts Outdated Show resolved Hide resolved
@raineorshine
Copy link
Contributor

When you rebase on main, note the signature for isDropdownOpen has changed: 9b340a2

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