Skip to content

Commit

Permalink
Merge pull request #86 from samply/refactor/fix-delete-icon-css
Browse files Browse the repository at this point in the history
feat(searchbar): fix css of delete icon
  • Loading branch information
patrickskowronekdkfz authored May 23, 2024
2 parents 9544186 + edb4c94 commit 54232b9
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/demo/public/delete_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/demo/public/options.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"iconOptions": {
"deleteUrl": "delete_icon.svg",
"infoUrl": "info-circle-svgrepo-com.svg",
"selectAll": {
"text": "Add all"
Expand Down
27 changes: 21 additions & 6 deletions packages/demo/src/ccp.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,31 @@ lens-search-bar-multiple::part(info-button-dialogue) {
text-align: left;
}

lens-search-bar-multiple::part(query-delete-button-item) {
border-color: var(--white);
lens-search-bar::part(delete-button-icon-item),
lens-search-bar-multiple::part(delete-button-icon-item) {
filter: invert(41%) sepia(43%) saturate(4610%) hue-rotate(357deg) brightness(96%) contrast(90%);
transform: translate(-1px, -1px);
width: 20px;
}

lens-search-bar-multiple::part(query-delete-button-group) {
background-color: var(--white);
border-color: var(--white);
lens-search-bar::part(delete-button-icon-group),
lens-search-bar-multiple::part(delete-button-icon) {
filter: invert(41%) sepia(43%) saturate(4610%) hue-rotate(357deg) brightness(96%) contrast(90%);
transform: translate(0px, 2px);
}

lens-search-bar::part(delete-button-icon),
lens-search-bar-multiple::part(delete-button-icon-value) {
transform: translate(-1px, -1px);
width: 20px;
}

lens-search-bar::part(delete-button-icon):hover,
lens-search-bar-multiple::part(delete-button-icon-value):hover {
filter: invert(38%) sepia(78%) saturate(1321%) hue-rotate(352deg) brightness(92%) contrast(99%);
}


lens-search-button::part(lens-search-button) {
background-color: var(--light-blue);
}
Expand All @@ -326,7 +342,6 @@ lens-search-button::part(lens-search-button):hover {

lens-search-button::part(lens-search-button):active {
background-color: #003d7e;
transform: translateX(1px);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/lib/src/components/Options.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
) {
store.set("infoUrl", options.iconOptions.infoUrl);
}
if (
"deleteUrl" in options.iconOptions &&
typeof options.iconOptions["deleteUrl"] === "string"
) {
store.set("deleteUrl", options.iconOptions.deleteUrl);
}
if (
"selectAll" in options.iconOptions &&
typeof options.iconOptions["selectAll"] === "object" &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
removeItemFromQuery,
removeValueFromQuery,
} from "../../stores/query";
import { iconStore } from "../../stores/icons";
import type { QueryItem } from "../../types/queryData";
export let itemToDelete: { type: string; index: number; item?: QueryItem };
$: deleteUrl = $iconStore.get("deleteUrl");
const { type, index, item } = itemToDelete;
/**
Expand Down Expand Up @@ -34,5 +37,15 @@

<button
part="query-delete-button query-delete-button-{type}"
on:click={deleteItem}>&#x2715;</button
on:click={deleteItem}
>
{#if deleteUrl}
<img
part="delete-button-icon delete-button-icon-{type}"
src={deleteUrl}
alt="delete icon"
/>
{:else}
&#x2715;
{/if}
</button>
2 changes: 1 addition & 1 deletion packages/lib/src/styles/searchbars.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ lens-search-bar-multiple::part(query-delete-button-item) {
position: absolute;
top: -6px;
right: -10px;
border: solid 2px var(--white);
border: solid 1px var(--white);
}

lens-search-bar::part(query-delete-button-group),
Expand Down

0 comments on commit 54232b9

Please sign in to comment.