Skip to content

Commit

Permalink
fix(kit): RadioBlock, CheckboxBlock properly align in Group (#4445
Browse files Browse the repository at this point in the history
)
  • Loading branch information
waterplea authored May 12, 2023
1 parent d5cc84f commit eca1ec4
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 26 deletions.
23 changes: 13 additions & 10 deletions projects/demo/src/modules/components/group/examples/4/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@
formControlName="testValue"
item="orange"
>
Oranges
</tui-radio-block>
<tui-radio-block
size="l"
contentAlign="right"
formControlName="testValue"
item="apple"
>
Apples
<div class="content">
<strong>Oranges</strong>
<div>An orange is a fruit of various citrus species in the family Rutaceae</div>
</div>
</tui-radio-block>
<tui-radio-block
size="l"
contentAlign="right"
formControlName="testValue"
item="pineapple"
>
Pineapples
<div class="content">
<strong>Pineapples</strong>
<div>
Not to be confused with neither
<em>pines</em>
nor
<em>apples</em>
</div>
</div>
</tui-radio-block>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.content {
padding: 0.5rem 0;
white-space: normal;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {encapsulation} from '@demo/emulate/encapsulation';
@Component({
selector: 'tui-group-example-4',
templateUrl: './index.html',
styleUrls: ['./index.less'],
changeDetection,
encapsulation,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class ExampleTuiGroupComponent {
readonly example4: TuiDocExample = {
TypeScript: import('./examples/4/index.ts?raw'),
HTML: import('./examples/4/index.html?raw'),
LESS: import('./examples/4/index.less?raw'),
};

adaptive = false;
Expand Down
34 changes: 20 additions & 14 deletions projects/kit/components/checkbox-block/checkbox-block.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@
padding: 0 0 0 1rem;
}

:host[data-size='s'] & {
min-height: var(--tui-height-s);
}

:host[data-size='m'] & {
min-height: var(--tui-height-m);
}

:host[data-size='l'] & {
min-height: var(--tui-height-l);
}

:host[data-size='s']._hidden_input & {
padding: 0 1rem;
}
Expand Down Expand Up @@ -77,11 +65,29 @@
}

.t-label {
.text-overflow();
display: flex;
flex-grow: 1;
align-self: center;
align-self: flex-start;
align-items: center;
overflow: hidden;

:host[data-size='s'] & {
min-height: var(--tui-height-s);
}

:host[data-size='m'] & {
min-height: var(--tui-height-m);
}

:host[data-size='l'] & {
min-height: var(--tui-height-l);
}

:host._hidden_input & {
text-align: center;
}
}

.t-content {
.text-overflow();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
(focusVisibleChange)="onFocusVisible($event)"
></tui-checkbox>
<div class="t-label">
<ng-content></ng-content>
<div class="t-content">
<ng-content></ng-content>
</div>
</div>
</label>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
(focusVisibleChange)="onFocusVisible($event)"
></tui-radio>
<div class="t-label">
<ng-content></ng-content>
<div class="t-content">
<ng-content></ng-content>
</div>
</div>
</label>

0 comments on commit eca1ec4

Please sign in to comment.