Fixed initial role selection and layout shift in <GhRoleSelection>

no issue

- initial role was always being set to Contributor due to incorrect argument being used when checking if the default role should be applied
- there was considerable layout shift of the `<GhRoleSelection>` container after role loading was finished, quick-fix applied by specifying a width and height to the loading spinner container that matches the final width/height
This commit is contained in:
Kevin Ansfield 2021-04-12 11:27:37 +01:00
parent c3c383ae69
commit 824953d162
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,9 @@
<div class="gh-roles-container" {{did-insert (perform this.fetchRolesTask)}}>
{{#if this.fetchRolesTask.isRunning}}
<GhLoadingSpinner />
{{!-- width and height are needed to avoid layout shift after roles have loaded --}}
<div style="width: 486px; height: 268px">
<GhLoadingSpinner />
</div>
{{else}}
<div class="gh-radio {{if (eq @selected.name "Contributor") "active"}}" {{on "click" (fn this.setRole "Contributor")}} data-test-option="Contributor">
<div class="gh-radio-button"></div>

View File

@ -28,7 +28,7 @@ export default class GhRoleSelectionComponent extends Component {
this.roles = roles;
if (!this.args.role && defaultRole) {
if (!this.args.selected && defaultRole) {
this.args.setRole(defaultRole);
}
}