Skip to content

Commit

Permalink
refactor(dropdown): update items sizes and paddings (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
didimmova authored Oct 1, 2024
1 parent 57a6315 commit b52f1a4
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 44 deletions.
7 changes: 3 additions & 4 deletions src/components/dropdown/themes/dropdown-item.base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
position: relative;
cursor: pointer;
outline-style: none;
padding-inline: pad-inline(rem(6px), rem(12px), rem(24px));
padding-block: pad-block(rem(2px), rem(4px), rem(8px));
padding-inline: pad-inline(rem(16px), rem(20px), rem(24px));
}

:host([disabled]) {
Expand Down Expand Up @@ -43,11 +42,11 @@
[name='prefix']::slotted(*) {
--component-size: var(--dropdown-size) !important;

margin-inline-end: pad(rem(16px));
margin-inline-end: pad(rem(8px));
}

[name='suffix']::slotted(*) {
--component-size: var(--dropdown-size) !important;

margin-inline-start: pad(rem(16px));
margin-inline-start: pad(rem(8px));
}
7 changes: 0 additions & 7 deletions src/components/dropdown/themes/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,18 @@ import { css } from 'lit';

import type { Themes } from '../../../theming/types.js';
// Shared Styles
import { styles as fluent } from './shared/header/dropdown-header.fluent.css.js';
import { styles as indigo } from './shared/header/dropdown-header.indigo.css.js';

const light = {
indigo: css`
${indigo}
`,
fluent: css`
${fluent}
`,
};

const dark = {
indigo: css`
${indigo}
`,
fluent: css`
${fluent}
`,
};

export const all: Themes = { light, dark };
1 change: 1 addition & 0 deletions src/components/dropdown/themes/shared/dropdown.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ $theme: $base;
}

[part='base'] {
box-shadow: var-get($theme, 'elevation');
background: var-get($theme, 'background-color');
border-radius: var-get($theme, 'border-radius');
}
3 changes: 0 additions & 3 deletions src/components/dropdown/themes/shared/dropdown.fluent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ $theme: $fluent;
--component-size: var(--ig-size, #{var-get($theme, 'default-size')});
}

[part='base'] {
box-shadow: var(--ig-elevation-4);
}
1 change: 0 additions & 1 deletion src/components/dropdown/themes/shared/dropdown.indigo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ $theme: $indigo;
}

[part='base'] {
box-shadow: var-get($theme, 'elevation');
padding: rem(3px);
outline: var-get($theme, 'border-width') solid var-get($theme, 'border-color');
outline-offset: rem(-1px);
Expand Down
5 changes: 0 additions & 5 deletions src/components/dropdown/themes/shared/dropdown.material.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ $theme: $material;
:host {
--component-size: var(--ig-size, #{var-get($theme, 'default-size')});
}

[part='base'] {
box-shadow: var(--ig-elevation-8);
padding: rem(8px) 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
$theme: $base;

:host {
height: var-get($theme, 'size');
color: var-get($theme, 'header-text-color');
padding-inline: pad-inline(rem(4px), rem(8px), rem(16px));
padding-block: pad-block(rem(2px), rem(4px), rem(8px));
padding-inline: pad-inline(rem(8px), rem(12px), rem(16px));
display: flex;
align-items: center;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

:host {
padding-inline: pad-inline(rem(8px), rem(12px), rem(12px));
padding-block: pad-inline(rem(4px), rem(6px), rem(8px));
margin-block-end: rem(2px);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$theme: $material;

:host {
height: var-get($theme, 'size');
border-radius: var-get($theme, 'item-border-radius');
color: var-get($theme, 'item-text-color');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

$theme: $fluent;

:host {
padding: pad(rem(2px), rem(4px), rem(8px));
}

:host([active]:hover) {
background: var-get($theme, 'hover-item-background');
color: var-get($theme, 'hover-item-text-color');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ $theme: $indigo;

:host {
padding-inline: pad-inline(rem(8px), rem(12px), rem(12px));
padding-block: pad-inline(rem(4px), rem(6px), rem(8px));
margin-block: rem(2px);

--item-icon: #{sizable(rem(14px), rem(16px), rem(16px))};
Expand All @@ -15,15 +14,6 @@ $theme: $indigo;
}
}

[name='prefix']::slotted(*) {
margin-inline-end: rem(8px);
}

[name='suffix']::slotted(*) {
margin-inline-start: rem(8px);
}

:host(:first-of-type),
:host(:last-of-type) {
margin-block: unset;
}
Expand Down
8 changes: 7 additions & 1 deletion stories/dropdown.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ const Items = [
'Documentation',
'Builds',
].map(
(each) => html`<igc-dropdown-item value=${each}>${each}</igc-dropdown-item>`
(each) =>
html`<igc-dropdown-item value=${each}
><igc-icon slot="prefix" name="github"></igc-icon>${each}<igc-icon
slot="suffix"
name="github"
></igc-icon
></igc-dropdown-item>`
);

const overflowItems = Array.from(range(1, 51)).map(
Expand Down

0 comments on commit b52f1a4

Please sign in to comment.