Skip to content

Commit

Permalink
remove repetitive hbs file code using loop
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamsinghbundela committed Jul 24, 2023
1 parent e1b082f commit 9b694b2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 40 deletions.
53 changes: 13 additions & 40 deletions app/components/new-signup/checkbox.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,20 @@
<h2 class='user-details__heading' data-test-signup-form-label>
{{this.label}}
</h2>

<div class='role-details__field'>
<label class='checkbox-label'>
<input
type='checkbox'
name='developer'
checked={{false}}
{{on 'change' this.checkboxFieldChanged}}
class='checkbox-input'
/>
Developer
</label>
<label class='checkbox-label'>
<input
type='checkbox'
name='designer'
checked={{false}}
{{on 'change' this.checkboxFieldChanged}}
class='checkbox-input'
/>
Designer
</label>
<label class='checkbox-label'>
<input
type='checkbox'
name='mavens'
checked={{false}}
{{on 'change' this.checkboxFieldChanged}}
class='checkbox-input'
/>
Mavens
</label>
<label class='checkbox-label'>
<input
type='checkbox'
name='productmanager'
checked={{false}}
{{on 'change' this.checkboxFieldChanged}}
class='checkbox-input'
/>
Product Manager
</label>
{{#each this.checkboxData as |data|}}
<label class='checkbox-label'>
<input
type='checkbox'
name={{data.name}}
checked={{false}}
{{on 'change' this.checkboxFieldChanged}}
class='checkbox-input'
/>
{{data.label}}
</label>
{{/each}}
</div>

<div class='signup-action__btn'>
Expand Down
19 changes: 19 additions & 0 deletions app/components/new-signup/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ import { action } from '@ember/object';
import { LABEL_TEXT } from '../../constants/new-signup';

export default class SignupComponent extends Component {
checkboxData = [
{
label: 'Developer',
name: 'developer',
},
{
label: 'Designer',
name: 'designer',
},
{
label: 'Mavens',
name: 'mavens',
},
{
label: 'Product Manager',
name: 'productmanager',
},
];

get label() {
const { currentStep } = this.args;

Expand Down

0 comments on commit 9b694b2

Please sign in to comment.