Skip to content

Commit

Permalink
feat: improve style for form-header to make it smaller in height
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaudAV authored and gcusnieux committed Mar 7, 2022
1 parent 540102e commit 0d60670
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 5 deletions.
6 changes: 6 additions & 0 deletions ui-particles-angular/.stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ module.exports = {
rules: {
'scss/dollar-variable-pattern': null,
'selector-class-pattern': null,
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['ng-deep'],
},
],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
class="gio-form-headers__table__header-row"
[formGroupName]="headerIndex"
>
<td>
<mat-form-field appearance="standard">
<td class="gio-form-headers__table__header-row__td-key">
<mat-form-field class="gio-form-headers__table__header-row__td-key__field" [floatLabel]="'never'">
<input formControlName="key" matInput type="text" placeholder="Name..." />
</mat-form-field>
</td>
<td>
<mat-form-field appearance="standard">
<td class="gio-form-headers__table__header-row__td-value">
<mat-form-field class="gio-form-headers__table__header-row__td-value__field" [floatLabel]="'never'">
<input formControlName="value" matInput type="text" placeholder="Value..." />
</mat-form-field>
</td>
<td>
<td class="gio-form-headers__table__header-row__td-remove">
<button
*ngIf="headersFormArray.controls.length - 1 !== headerIndex"
mat-icon-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,43 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

:host {
display: block;
}

.gio-form-headers {
&__table {
width: 100%;

&__header-row {
&__td-key,
&__td-value {
&__field {
display: flex;
overflow: hidden;
height: 32px;
flex-direction: column;
justify-content: center;
}
}

&__td-remove {
width: 32px;
height: 32px;
padding: 0;
}
}
}
}

::ng-deep {
gio-form-headers {
.gio-form-headers__table__header-row {
// Allow to have form-field with width less than 180px
.mat-form-field-infix {
width: inherit;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,26 @@ export const ReactiveForm: Story = {
disabled: false,
},
};

export const SmallWidth: Story = {
render: args => ({
template: `<div style="width: 200px;"><gio-form-headers [ngModel]="headers"></gio-form-headers></div>`,
props: args,
}),
args: {
headers: [
{
key: 'host',
value: 'api.gravitee.io',
},
{
key: 'accept',
value: '*/*',
},
{
key: 'connection',
value: 'keep-alive',
},
],
},
};

0 comments on commit 0d60670

Please sign in to comment.