Skip to content

Commit ec0a69e

Browse files
committed
feat(tile-manager): resize icon and styles
1 parent 3b04b5b commit ec0a69e

File tree

9 files changed

+91
-33
lines changed

9 files changed

+91
-33
lines changed

src/components/icon/icon-references.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,9 @@ addIcon('collapse_content', {
299299
collection: 'internal',
300300
},
301301
});
302+
addIcon('resize', {
303+
default: {
304+
name: 'resize',
305+
collection: 'internal',
306+
},
307+
});

src/components/icon/internal-icons-lib.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ export const internalIcons = new Map<string, SvgIcon>(
7474
fullscreen_exit: {
7575
svg: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px"><path d="M240-120v-120H120v-80h200v200h-80Zm400 0v-200h200v80H720v120h-80ZM120-640v-80h120v-120h80v200H120Zm520 0v-200h80v120h120v80H640Z"/></svg>`,
7676
},
77+
resize: {
78+
svg: `<svg width="9" height="9" viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.30362 0L0 8.30362L0.691969 8.99559L8.99559 0.691968L8.30362 0Z"/><path d="M8.30803 3.46558L3.46425 8.30936L4.15622 9.00132L9 4.15755L8.30803 3.46558Z"/></svg>`,
79+
},
7780
indigo_clear: {
7881
svg: `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 24 24">
7982
<path d="M14.8144 11.9896L18.4171 8.39087C18.7818 8.0135 18.9836 7.50809 18.9791 6.98347C18.9745 6.45885 18.764 5.95699 18.3927 5.58602C18.0215 5.21504 17.5192 5.00464 16.9942 5.00008C16.4692 4.99552 15.9635 5.19718 15.5858 5.56166L11.9896 9.15372L8.39335 5.56166C8.01571 5.19718 7.50992 4.99552 6.98492 5.00008C6.45992 5.00464 5.95769 5.21505 5.58645 5.58602C5.2152 5.95699 5.00464 6.45885 5.00008 6.98347C4.99551 7.50809 5.19733 8.0135 5.56207 8.39087L9.18561 12.0104L5.58291 15.6091C5.21817 15.9865 5.01635 16.4919 5.02091 17.0165C5.02548 17.5412 5.23604 18.043 5.60729 18.414C5.97853 18.785 6.48075 18.9954 7.00576 18.9999C7.53076 19.0045 8.03654 18.8028 8.41419 18.4383L12.0104 14.8463L15.6067 18.4383C15.9843 18.8028 16.4901 19.0045 17.0151 18.9999C17.5401 18.9954 18.0423 18.785 18.4136 18.414C18.7848 18.043 18.9954 17.5412 18.9999 17.0165C19.0045 16.4919 18.8027 15.9865 18.4379 15.6091L14.8144 11.9896Z"/>

src/components/tile-manager/resize-element.ts

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LitElement, css, html } from 'lit';
1+
import { LitElement, html } from 'lit';
22
import { property, state } from 'lit/decorators.js';
33
import { type Ref, createRef, ref } from 'lit/directives/ref.js';
44
import {
@@ -13,6 +13,8 @@ import {
1313
type ResizeMode,
1414
addResizeController,
1515
} from './resize-controller.js';
16+
import { styles } from './themes/resize.base.css.js';
17+
import { styles as shared } from './themes/shared/resize.common.css.js';
1618

1719
export interface IgcResizeComponentEventMap {
1820
igcResizeStart: CustomEvent<ResizeCallbackParams>;
@@ -26,28 +28,7 @@ export default class IgcResizeComponent extends EventEmitterMixin<
2628
Constructor<LitElement>
2729
>(LitElement) {
2830
public static tagName = 'igc-resize';
29-
30-
public static styles = css`
31-
:host {
32-
display: contents;
33-
}
34-
35-
[part='resize-base'] {
36-
position: relative;
37-
height: 100%;
38-
}
39-
40-
[part='trigger'] {
41-
position: absolute;
42-
bottom: 0;
43-
right: 0;
44-
z-index: 1;
45-
}
46-
47-
[part='trigger']:focus {
48-
outline: none;
49-
}
50-
`;
31+
public static styles = [styles, shared];
5132

5233
/* blazorSuppress */
5334
public static register() {
@@ -144,7 +125,9 @@ export default class IgcResizeComponent extends EventEmitterMixin<
144125
return html`
145126
<div part="resize-base">
146127
<slot></slot>
147-
<div ${ref(this._adorner)} part="trigger" tabindex="-1">↘️</div>
128+
<div ${ref(this._adorner)} part="trigger" tabindex="-1">
129+
<igc-icon name="resize" collection="default"></igc-icon>
130+
</div>
148131
</div>
149132
`;
150133
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@use 'styles/common/component';
2+
@use 'styles/utilities' as *;
3+
4+
:host {
5+
display: contents;
6+
}
7+
8+
[part='resize-base'] {
9+
position: relative;
10+
height: 100%;
11+
}
12+
13+
[part='trigger'] {
14+
display: inline-flex;
15+
position: absolute;
16+
bottom: rem(2px);
17+
right: rem(2px);
18+
z-index: 1;
19+
20+
igc-icon {
21+
$icon-size: rem(9px);
22+
23+
--size: #{$icon-size} !important;
24+
--ig-icon-size: #{$icon-size};
25+
--igx-icon-size: #{$icon-size};
26+
}
27+
}
28+
29+
[part='trigger']:focus {
30+
outline: none;
31+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@use 'styles/utilities' as *;
2+
@use '../light/themes' as *;
3+
4+
$theme: $material;
5+
6+
[part='trigger'] {
7+
igc-icon {
8+
color: var-get($theme, 'resize-indicator');
9+
}
10+
}

src/components/tile-manager/themes/shared/tile/tile.common.scss

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ $theme: $material;
1010
[part~='base'] {
1111
background: var-get($theme, 'tile-background');
1212
border-radius: var-get($theme, 'border-radius');
13-
border: rem(1px) solid var-get($theme, 'border-color');
1413
box-shadow: var-get($theme, 'resting-elevation');
1514

1615
&:hover {
17-
border-color: var-get($theme, 'hover-border-color');
16+
&::after {
17+
content: '';
18+
position: absolute;
19+
pointer-events: none;
20+
border-radius: inherit;
21+
inset: 0;
22+
width: 100%;
23+
height: 100%;
24+
border: rem(1px) solid var-get($theme, 'hover-border-color');
25+
}
1826
}
1927
}
2028

@@ -23,11 +31,13 @@ $theme: $material;
2331
box-shadow: var-get($theme, 'drag-elevation');
2432
}
2533

26-
[part~='resizing'] {
34+
[part~='base'][part~='resizing']{
2735
opacity: .3;
2836

2937
&:hover {
30-
border: rem(1px) solid var-get($theme, 'border-color');
38+
&::after {
39+
display: none;
40+
}
3141
}
3242
}
3343

src/components/tile-manager/themes/tile-manager.base.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
padding: rem(20px);
1212
width: 100%;
1313
height: 100%;
14-
grid-template-columns: repeat(var(--ig-column-count, auto-fit), minmax(var(--ig-min-col-width, 200px), 1fr));
15-
grid-auto-rows: minmax(var(--ig-min-row-height, 200px), auto);
14+
grid-template-columns: repeat(var(--ig-column-count, auto-fit), minmax(var(--ig-min-col-width), 1fr));
15+
grid-auto-rows: minmax(var(--ig-min-row-height), auto);
1616
grid-gap: rem(10px);
1717
grid-auto-flow: dense;
1818
}

src/components/tile-manager/themes/tile.base.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
[part='content-container'] {
1717
display: block;
1818
overflow: auto;
19+
border-radius: inherit;
1920

2021
::slotted(*) {
2122
@include type-style('body-1');

src/components/tile-manager/tile.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,31 @@ export default class IgcTileComponent extends EventEmitterMixin<
372372
.getComputedStyle(this)
373373
.getPropertyValue('--ghost-border');
374374

375-
const ghost = this.cloneNode(true) as IgcTileComponent;
375+
const ghostBorderRadius = window
376+
.getComputedStyle(this)
377+
.getPropertyValue('--border-radius');
378+
379+
const ghostMinWidth = window
380+
.getComputedStyle(this)
381+
.getPropertyValue('--ig-min-col-width');
382+
383+
const ghostMinHeight = window
384+
.getComputedStyle(this)
385+
.getPropertyValue('--ig-min-row-height');
386+
387+
const ghost = document.createElement('div');
376388
Object.assign(ghost.style, {
377389
position: 'absolute',
378390
top: 0,
379391
left: 0,
380392
zIndex: 1000,
381393
background: ghostBackground,
382394
border: `1px solid ${ghostBorder}`,
383-
borderRadius: '4px',
395+
borderRadius: ghostBorderRadius,
384396
width: '100%',
385397
height: '100%',
398+
minWidth: ghostMinWidth,
399+
minHeight: ghostMinHeight,
386400
gridRow: '',
387401
gridColumn: '',
388402
});
@@ -427,7 +441,7 @@ export default class IgcTileComponent extends EventEmitterMixin<
427441
? this.renderContent()
428442
: html`
429443
<igc-resize
430-
part="base"
444+
part="resize"
431445
.ghostFactory=${this.ghostFactory}
432446
mode="deferred"
433447
@igcResize=${this._handleResize}

0 commit comments

Comments
 (0)