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(StudioToggleableTextfield): Create components to handle toggleable textfields and validation #12214

Conversation

JamalAlabdullah
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah commented Jan 31, 2024

Description

This PR developed an input component that can toggle between viewing and editing modes. This component exists in two variants: one that accepts custom validation rules and one that validates against JSON schema. The variants are called StudioToggleableTextfield and StudioToggleableTextfieldSchema, respectively. StudioToggleableTextfieldSchema builds upon StudioToggleableTextfield to separate logic and isolate the components as much as possible. Both variants are extensions of the StudioIconTexfield component, which supports an icon to the left of the input field and extends the basic StudioTextfield component.

This PR includes AJV as a dependency in studio-components. Additionally, some types necessary for implementing JSON schema validation have been moved into the studio-components package.

Note: We should consider to make a folder named form that includes all the form components we have in Studio components.

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

@github-actions github-actions bot added area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. solution/studio/designer Issues related to the Altinn Studio Designer solution. labels Jan 31, 2024
Copy link
Member

@nkylstad nkylstad left a comment

Choose a reason for hiding this comment

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

I have so far only looked at the EditComponentId implementation, I have a comment there for consideration.

Also, I noticed that there are some spacing issues when I tested the branch locally - there is too much space on either side of the component. The button itself seems to be correctly aligned, but I would expect the content to be left-aligned with the other content in the column.
Seems like overriding the button's style to remove padding-left might help 🤔

Screenshot 2024-01-31 at 15 03 48

@github-actions github-actions bot added the kind/dependencies Used for issues or pull requests that are dependency updates label Feb 27, 2024
@framitdavid framitdavid marked this pull request as draft February 27, 2024 21:54
@github-actions github-actions bot added the skip-releasenotes Issues that do not make sense to list in our release notes label Feb 29, 2024
@framitdavid framitdavid marked this pull request as ready for review February 29, 2024 11:09
@Altinn Altinn deleted a comment from codecov bot Feb 29, 2024
@Altinn Altinn deleted a comment from codecov bot Feb 29, 2024
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 94.40000% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 87.21%. Comparing base (dd15565) to head (0fb82d9).
Report is 1 commits behind head on main.

Files Patch % Lines
...ioToggleableTextfieldSchema/JsonSchemaValidator.ts 92.00% 1 Missing and 1 partial ⚠️
...esHeader/EditComponentIdRow/EditComponentIdRow.tsx 90.47% 1 Missing and 1 partial ⚠️
frontend/app-development/router/routes.tsx 66.66% 1 Missing ⚠️
.../src/components/StudioToggleableTextfield/index.ts 75.00% 1 Missing ⚠️
...omponents/StudioToggleableTextfieldSchema/index.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12214      +/-   ##
==========================================
+ Coverage   87.15%   87.21%   +0.06%     
==========================================
  Files        1200     1209       +9     
  Lines       18049    18154     +105     
  Branches     2300     2315      +15     
==========================================
+ Hits        15730    15833     +103     
- Misses       2040     2041       +1     
- Partials      279      280       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@framitdavid framitdavid left a comment

Choose a reason for hiding this comment

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

Nice! Last few things we need to do! 🚀

Copy link
Collaborator

@framitdavid framitdavid left a comment

Choose a reason for hiding this comment

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

@JamalAlabdullah can you cross check my commits and approve if you agree or give me some feedback if you disagree. 😊

@framitdavid framitdavid changed the title 12181 update editcomponentid component to match new design feat(StudioToggleableTextfield): Create components to handle toggleable textfields and validation Mar 1, 2024
@JamalAlabdullah
Copy link
Contributor Author

@framitdavid Everything looks nice😊 thanks for your contribution ❤️

@JamalAlabdullah JamalAlabdullah merged commit c0bb053 into main Mar 1, 2024
11 checks passed
@JamalAlabdullah JamalAlabdullah deleted the 12181-update-editcomponentid-component-to-match-new-design branch March 1, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. kind/dependencies Used for issues or pull requests that are dependency updates skip-releasenotes Issues that do not make sense to list in our release notes solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update EditComponentId component to match new design
3 participants