Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-2653: Introduce colorful ibexa-tag and ibexa-tag-view-select #389

Merged
merged 3 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bundle/Resources/public/scss/_main-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
&--selected {
color: $ibexa-color-info;
background-color: $ibexa-color-info-800;

.ibexa-main-menu {
&__item-icon {
fill: $ibexa-color-info;
}

&__item-text-column {
color: $ibexa-color-info;
}
Expand Down
9 changes: 1 addition & 8 deletions src/bundle/Resources/public/scss/_page-title.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@
display: flex;
}

.ibexa-tag {
max-height: calculateRem(28px);
.ibexa-badge {
margin-left: calculateRem(8px);
padding: calculateRem(2px) calculateRem(12px);

&__content {
font-weight: normal;
font-size: $ibexa-text-font-size-medium;
}
}
}
4 changes: 2 additions & 2 deletions src/bundle/Resources/public/scss/_popup-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
border-top: calculateRem(1px) solid $ibexa-color-info-800;

.ibexa-popup-menu__items-list {
padding-left: calculateRem(6px)
padding-left: calculateRem(6px);
}
}

Expand Down Expand Up @@ -99,7 +99,7 @@

&--group-name {
color: $ibexa-color-light-700;

&:hover {
background-color: initial;
color: $ibexa-color-light-700;
Expand Down
71 changes: 46 additions & 25 deletions src/bundle/Resources/public/scss/_tag-view-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
padding: calculateRem(24px);

&__info {
@include ibexa-font-sans-serif();

font-size: $ibexa-text-font-size-medium;
color: $ibexa-color-black;
white-space: nowrap;
Expand All @@ -23,13 +21,14 @@
&__selected-item-tag {
display: inline-flex;
align-items: center;
height: calculateRem(24px);
max-width: 100%;
padding: 0 calculateRem(8px);
border-radius: $ibexa-border-radius;
background-color: $ibexa-color-light-400;
height: calculateRem(24px);
padding: calculateRem(4px) calculateRem(10px);
font-size: $ibexa-text-font-size-small;
line-height: calculateRem(18px);
line-height: calculateRem(16px);
font-weight: normal;
border-radius: calculateRem(12px);
background-color: $ibexa-color-light-500;
margin-top: calculateRem(5px);
margin-bottom: calculateRem(5px);

Expand Down Expand Up @@ -67,25 +66,59 @@
text-overflow: ellipsis;
color: transparent;

&--start {
width: 100%;

&--start,
&--end {
.ibexa-tag-view-select__selected-item-tag-content-ellipsized {
color: $ibexa-color-black;
}
}

&--start {
width: 100%;
}

&--end {
width: 0;
direction: rtl;
text-align: right;
}
}

.ibexa-tag-view-select__selected-item-tag-content-ellipsized {
color: $ibexa-color-black;
$color-versions: 'primary' $ibexa-color-primary $ibexa-color-primary-200, 'secondary' $ibexa-color-dark $ibexa-color-light-500,
'info' $ibexa-color-info $ibexa-color-info-200, 'danger' $ibexa-color-danger $ibexa-color-danger-200,
'success' $ibexa-color-success $ibexa-color-success-200, 'complementary' $ibexa-color-complementary $ibexa-color-complementary-200;

@mixin colorful-tags($color-text, $color-background) {
.ibexa-tag-view-select {
&__selected-item-tag {
background-color: $color-background;

.ibexa-icon {
fill: $color-text;
}
}

&__selected-item-tag-ellipsize {
color: $color-text;
}

&__selected-item-tag-content {
&--start,
&--end {
.ibexa-tag-view-select__selected-item-tag-content-ellipsized {
color: $color-text;
}
}
}
}
}

@each $name, $color-text, $color-background in $color-versions {
&--#{$name} {
@include colorful-tags($color-text, $color-background);
}
}

&__selected-item-tag-remove-btn {
padding: 0;
margin-left: calculateRem(12px);
Expand All @@ -94,18 +127,6 @@

&:disabled,
&[disabled] {
border-color: $ibexa-color-light;

.ibexa-tag-view-select {
&__info {
color: $ibexa-color-dark-300;
}

&__selected_item {
color: $ibexa-color-dark-400;
fill: $ibexa-color-dark-400;
background-color: $ibexa-color-light-300;
}
}
@include colorful-tags($ibexa-color-dark-400, $ibexa-color-light-300);
}
}
43 changes: 34 additions & 9 deletions src/bundle/Resources/public/scss/_tag.scss
Original file line number Diff line number Diff line change
@@ -1,32 +1,57 @@
.ibexa-tag {
border-radius: calculateRem(18px);
background: $ibexa-color-light-300;
font-size: $ibexa-text-font-size-small;
padding: calculateRem(2px) calculateRem(28px) calculateRem(2px) calculateRem(8px);
display: inline-block;
display: inline-flex;
align-items: center;
position: relative;
height: calculateRem(24px);
padding: calculateRem(4px) calculateRem(24px) calculateRem(4px) calculateRem(10px);
border-radius: calculateRem(12px);
background-color: $ibexa-color-light-500;

&__content {
line-height: calculateRem(22px);
font-size: $ibexa-text-font-size-small;
font-weight: normal;
}

&__spinner {
height: calculateRem(22px);
line-height: 0;

.ibexa-icon {
fill: $ibexa-color-dark;
}
}

&__remove-btn {
position: absolute;
top: calc(50% - #{calculateRem(8px)});
right: calculateRem(6px);
right: calculateRem(8px);
cursor: pointer;
border: 0;
padding: 0;
outline: none;
line-height: 0;

&:disabled {
&:disabled,
&[disabled] {
cursor: not-allowed;
}
}

$color-versions: 'primary' $ibexa-color-primary $ibexa-color-primary-200, 'secondary' $ibexa-color-dark $ibexa-color-light-500,
'info' $ibexa-color-info $ibexa-color-info-200, 'danger' $ibexa-color-danger $ibexa-color-danger-200,
'success' $ibexa-color-success $ibexa-color-success-200, 'complementary' $ibexa-color-complementary $ibexa-color-complementary-200;

@each $name, $color-text, $color-background in $color-versions {
&--#{$name} {
color: $color-text;
background-color: $color-background;

.ibexa-tag {
&__remove-btn,
&__spinner,
.ibexa-icon {
fill: $color-text;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<h1 class="ibexa-page-title__title">
{{ title }}
{% if tag is defined %}
<div class="ibexa-tag">
<div class="ibexa-tag__content">{{ tag }}</div>
<div class="ibexa-badge">
{{ tag }}
</div>
{% endif %}
</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<div class="ibexa-tag__content">
{{ content }}
</div>
<button
type="button"
<button
type="button"
class="ibexa-tag__remove-btn {{ btn_class }}"
data-target-selector="{{ target_selector }}"
>
<svg class="ibexa-icon ibexa-icon--small">
<use xlink:href="{{ ibexa_icon_path('circle-close') }}"></use>
<svg class="ibexa-icon ibexa-icon--tiny">
<use xlink:href="{{ ibexa_icon_path('discard') }}"></use>
</svg>
</button>
</div>
6 changes: 3 additions & 3 deletions src/bundle/Resources/views/themes/admin/ui/tag.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
{{ content }}
</div>
<div class="ibexa-tag__spinner" {% if not is_loading_state %} hidden {% endif %}>
<svg class="ibexa-icon ibexa-icon--small ibexa-icon--dark ibexa-spin">
<svg class="ibexa-icon ibexa-icon--small ibexa-spin">
<use xlink:href="{{ ibexa_icon_path('spinner') }}"></use>
</svg>
</div>
<button type="button" class="ibexa-tag__remove-btn">
<svg class="ibexa-icon ibexa-icon--small ibexa-icon--dark">
<use xlink:href="{{ ibexa_icon_path('circle-close') }}"></use>
<svg class="ibexa-icon ibexa-icon--tiny">
<use xlink:href="{{ ibexa_icon_path('discard') }}"></use>
</svg>
</button>
</div>