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

feat(apps/studio): Checkbox implementation for Storybook #688

Merged
merged 9 commits into from
Sep 1, 2023

Conversation

melihcanclk
Copy link
Contributor

@melihcanclk melihcanclk commented Aug 24, 2023

Description

  • Added Default, With Text, Inside Form, OnFocus and Default Check parts done for checkbox Storybook.
  • checked, disable, asChild and children props can be changed from the table.

Checklist

  • discord username: cilek
  • Closes feat(apps/ui): Add control to the checkbox component in the storybook. #669
  • PR must be created for an issue from issues under "In progress" column from our project board.
  • A descriptive and understandable title: The PR title should clearly describe the nature and purpose of the changes. The PR title should be the first thing displayed when the PR is opened. And it should follow the semantic commit rules, and should include the app/package/service name in the title. For example, a title like "docs(@kampus-apps/pano): Add README.md" can be used.
  • Related file selection: Only relevant files should be touched and no other files should be affected.
  • I ran npx turbo run at the root of the repository, and build was successful.
  • I installed the npm packages using npm install --save-exact <package> so my package is pinned to a specific npm version. Leave empty if no package was installed. Leave empty if no package was installed with this PR.

How were these changes tested?

Please describe the tests you did to test the changes you made. Please also specify your test configuration.

@melihcanclk melihcanclk requested a review from a team as a code owner August 24, 2023 20:25
@vercel
Copy link

vercel bot commented Aug 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
kampus-studio ⬜️ Ignored (Inspect) Visit Preview Sep 1, 2023 8:43am

@vercel
Copy link

vercel bot commented Aug 24, 2023

@melihcanclk is attempting to deploy a commit to the kamp-us Team on Vercel.

A member of the Team first needs to authorize it.

Use different settings for my mobile devices
</FormLabel>
<FormDescription>
You can manage your mobile notifications in the <Link href="/examples/forms">mobile settings</Link> page.
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the purpose of using Link component here? If it was for routing, let's not use Link, if it was for an icon, lets rearrange it so it won't be pushed to a new line.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In shadcn ui checkbox, there were some examples about checkbox and i tried to integrate those examples into our storybook but in form the link component was in use so i used it. It's my mistake that I didn't look how it should be look like in shadcn ui. I'll fix this now by removing Link component.

Copy link
Contributor

Choose a reason for hiding this comment

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

no problem at all! ty so much for the effort! 🚀

},
} satisfies Story;

export const OnFocus = {
Copy link
Contributor

Choose a reason for hiding this comment

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

@usirin if you can take a look at this and show a pointer to handle this correctly, that would be awesome!

-- we shouldn't manipulate DOM and focus is not doing what it meant to do, so this needs to be addressed but lets wait an answer from @usirin first

Copy link
Member

Choose a reason for hiding this comment

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

@melihcanclk Easiest would be creating a component inside this file and use state with proper onFocus handlers over there

Copy link
Contributor Author

@melihcanclk melihcanclk Aug 26, 2023

Choose a reason for hiding this comment

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

I tried to remove component inside OnFocus story and implement a component that makes handling with useState hook but realize that i have to give onFocus function outside of the component so to change the state inside onFocus function, i shouldn't make changes in Checkbox props, meaning it should take {...props} and with changing args to that component, we should do the change but this is my idea. If there is any way to change text inside the component by giving useState from args, I can implement it but this is what i did

Screenshot from 2023-08-26 11-04-15

I can commit this without the args at the down below in the story part or I can remove the whole onFocus part either because it really doesn't metter, why do i think in this way is that in Shadcn UI components' examples, there is no onFocus example. It has only With Text, Disabled and Form examples where all are implemented already, and if this is ok, i can do one extra thing that i did think that i could be doing but i didn't because of this same reason which is changing color of background and border of the checkbox over table down below.

Copy link
Contributor

Choose a reason for hiding this comment

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

I made some comments about this and I think the way you handled in the new version looks good to me! After you make those changes, we can review it again and merge this :) Thank you so much for the hard work and thinking about additions to the regular use cases 🚀 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried to fix those and I'll be waiting for your feedback, thank you for your comments dear @cansirin 💜.

@cansirin cansirin requested review from usirin and removed request for gurkanguray and igdiaysu August 25, 2023 08:18
<div className="grid gap-1.5 leading-none">
<Label
htmlFor="terms1"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
Copy link
Contributor

Choose a reason for hiding this comment

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

we should give a font color to this label, ideally text-primary.

render: ({ ...props }) => <OnFocusTemplate {...props} />,
} satisfies Story;

const DescriptionTemplate = ({ ...props }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

we can rename this as DefaultTemplate

})}
<div className="flex items-center space-x-2">
<Checkbox id="checkbox"
onFocus={() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also use onBlur handler in order to handle focus loss.

{...props} />
<Label
htmlFor="checkbox"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
Copy link
Contributor

Choose a reason for hiding this comment

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

we need font color here too, please use text-primary

Copy link
Contributor

@cansirin cansirin left a comment

Choose a reason for hiding this comment

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

💯 🚀

@cansirin cansirin merged commit 52ba835 into kamp-us:dev Sep 1, 2023
2 checks passed
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.

feat(apps/ui): Add control to the checkbox component in the storybook.
3 participants