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

Feature/459 affix functionality for kirby input #2390

Closed

Conversation

tspringborg
Copy link
Contributor

@tspringborg tspringborg commented Jul 4, 2022

Why is this a draft?

I'd like to discuss some things I'm not completely happy with.

There are a couple of things.

  1. In order to fix a compatibility issue when using the affix directive in conjunction with the date-mask directive, the affix directive simply removes the date-mask input field. Which doesn't seem to do anything atm. Is there a better way that doesn't require refactoring form field and related components? ..and is the extra date-mask input actually needed?

  2. The CSS variables had to be added in quite a few places. Is there a better approach? (While still using CSS variables)

Which issue does this PR close?

This PR closes #459

What is the new behavior?

Added affix directive for kirby input fields

Does this PR introduce a breaking change?

  • Yes
  • No

Sort of. Since there's a compatibility issue with data-mask the affix directive will remove the extra input the date-mask adds.

Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Reminders

  • Make sure you have implemented tests following the guidelines in: "The good: Test".
  • Make sure you have updated the cookbook with examples and showcases (for bug fixes, enhancements & new components).

Review

  • Do a self-review.
  • Request that the changes are code-reviewed
  • Request that the changes are UX reviewed (only necessary if your PR introduces visual changes)

When the pull request has been approved it will be merged to develop by Team Kirby.

@jkaltoft jkaltoft requested a review from RasmusKjeldgaard July 4, 2022 11:37
@github-actions github-actions bot temporarily deployed to pr-459-affix-functionality-for-kirby-input July 4, 2022 12:27 Inactive
@tspringborg tspringborg marked this pull request as ready for review July 5, 2022 08:59
@tspringborg tspringborg requested a review from jkaltoft as a code owner July 5, 2022 08:59
@@ -5,7 +5,7 @@ import { InputSize } from '@kirbydesign/designsystem';
const config = {
selector: 'cookbook-form-field-input-example',
template: `<kirby-form-field>
<input kirby-input [size]="size" placeholder="Default input with placeholder text" />
<input kirby-input [size]="size" placeholder="Default input with placeholder text." />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

a mistake. Disregard

Copy link
Collaborator

@jkaltoft jkaltoft left a comment

Choose a reason for hiding this comment

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

I've done a quick pre-review on the stylesheets (mostly about using Sass Modules).

Regarding...

The CSS variables had to be added in quite a few places. Is there a better approach? (While still using CSS variables)

...I'm convinced there may be a better approach, but I'll need some time to dig a bit deeper to come up with an idea for a solution.

Comment on lines +191 to +194
$form-field-input-font-family: var(--kirby-font-family);
$form-field-input-line-height: 1.5;
$form-field-input-padding: 1em;
$form-field-label-height: 24px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

These Sass variables should stay in libs/designsystem/src/lib/components/form-field/_form-field-inputs.shared.scss

Copy link
Contributor Author

@tspringborg tspringborg Jul 5, 2022

Choose a reason for hiding this comment

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

If they stay there. Then how can I import them without all the styles getting applied as well?

I'm not so familiar with Sass modules. So perhaps use will solve this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When using form_field-inputs.shared, the importing scss file willl still apply all styles to the element importing.

So use does not solve it sadly...

$form-field-input-line-height: 1.5;
$form-field-input-padding: 1em;
$form-field-label-height: 24px;
@import '~@kirbydesign/core/src/scss/base/variables';
Copy link
Collaborator

Choose a reason for hiding this comment

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

We use Sass Modules, so @import should not be used.

See e.g. https://sass-lang.com/documentation/at-rules/use and https://css-tricks.com/introducing-sass-modules/

$form-field-input-line-height: 1.5;
$form-field-input-padding: 1em;
$form-field-label-height: 24px;
@import '~@kirbydesign/core/src/scss/base/variables';
Copy link
Collaborator

Choose a reason for hiding this comment

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

@kirbydesign/core/src/scss/base/variables is already included in @kirbydesign/core/src/scss/utils so this line should be removed

@@ -0,0 +1,18 @@
@import '~@kirbydesign/core/src/scss/base/variables';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Import other Sass files with @use instead of @import (Sass modules)

Suggested change
@import '~@kirbydesign/core/src/scss/base/variables';
@use '../form-field-inputs.shared' as shared;

(change the relative path if I got the wrong number of ..s 🙂)

@import '~@kirbydesign/core/src/scss/base/variables';

:host {
--input-padding: #{$form-field-input-padding};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--input-padding: #{$form-field-input-padding};
--input-padding: #{shared.$form-field-input-padding};

Comment on lines +12 to +17
&.default {
font-size: 16px;
line-height: 24px;
letter-spacing: 0;
color: #707070;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should use design tokens and utility functions - not hardcoded values. E.g. font-size: utils.font-size('n');. The same goes for colors.

@tspringborg tspringborg marked this pull request as draft July 5, 2022 10:13
@kirbydesign kirbydesign deleted a comment from jkaltoft Jul 5, 2022
@github-actions github-actions bot temporarily deployed to pr-459-affix-functionality-for-kirby-input July 12, 2022 10:35 Inactive
@stale
Copy link

stale bot commented Sep 26, 2022

This pull request has been automatically marked as stale because of no recent activity. It will be closed in 10 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Automatically applied when there is no activity on an issue or PR label Sep 26, 2022
@RasmusKjeldgaard
Copy link
Collaborator

Replaced by #2406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Automatically applied when there is no activity on an issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Ability to add prefix and suffix
4 participants