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

Refactor the AuDateInput component #431

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions addon/components/au-date-input.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<span class="au-c-input-wrapper {{this.width}}">
<input
class="au-c-input
{{this.error}}
{{this.warning}}
{{this.width}}
{{this.disabled}}"
disabled={{@disabled}}
placeholder="DD-MM-JJJJ"
autocomplete="off"
...attributes
{{this.dateInput value=@value prefillYear=@prefillYear onChange=@onChange}}
/>
<AuIcon @icon="calendar" @alignment="left" />
</span>
<AuInput
@disabled={{@disabled}}
@error={{@error}}
@icon="calendar"
@warning={{@warning}}
@width={{@width}}
autocomplete="off"
placeholder="DD-MM-JJJJ"
{{this.dateInput value=@value prefillYear=@prefillYear onChange=@onChange}}
...attributes
/>
22 changes: 0 additions & 22 deletions addon/components/au-date-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,6 @@ import {

export default class AuDateInputComponent extends Component {
dateInput = DateInputModifier;

// These getters need to be kept in sync with the AuInput component.
// Once we refactor that component so it no longer uses `<Input>` we can remove the duplication and wrap AuInput instead.
get width() {
if (this.args.width == 'block') return 'au-c-input--block';
else return '';
}

get error() {
if (this.args.error) return 'au-c-input--error';
else return '';
}

get warning() {
if (this.args.warning) return 'au-c-input--warning';
else return '';
}

get disabled() {
if (this.args.disabled) return 'is-disabled';
else return '';
}
}

class DateInputModifier extends Modifier {
Expand Down