-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature/459 affix functionality for kirby input #2390
Conversation
@@ -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." /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a mistake. Disregard
There was a problem hiding this 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.
$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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2390 (comment)
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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)
@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}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--input-padding: #{$form-field-input-padding}; | |
--input-padding: #{shared.$form-field-input-padding}; |
&.default { | ||
font-size: 16px; | ||
line-height: 24px; | ||
letter-spacing: 0; | ||
color: #707070; | ||
} |
There was a problem hiding this comment.
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.
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. |
Replaced by #2406 |
Why is this a draft?
I'd like to discuss some things I'm not completely happy with.
There are a couple of things.
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?
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?
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
Review
When the pull request has been approved it will be merged to
develop
by Team Kirby.