-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5515 from solidusio/elia/misc-improvements
[admin] Misc improvements
- Loading branch information
Showing
29 changed files
with
420 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ version: 2.1 | |
|
||
orbs: | ||
browser-tools: circleci/[email protected] | ||
codecov: codecov/codecov@3.2.3 | ||
codecov: codecov/codecov@3.3.0 | ||
|
||
executors: | ||
base: | ||
|
3 changes: 2 additions & 1 deletion
3
admin/app/components/solidus_admin/layout/navigation/account/component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
admin/app/components/solidus_admin/layout/navigation/account/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import { useClickOutside } from "stimulus-use" | ||
|
||
export default class extends Controller { | ||
connect() { | ||
useClickOutside(this) | ||
} | ||
|
||
clickOutside() { | ||
this.close() | ||
} | ||
|
||
close() { | ||
this.element.removeAttribute("open") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
admin/app/components/solidus_admin/ui/dropdown/component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<details | ||
<%= tag.attributes @attributes %> | ||
> | ||
<summary | ||
class=" | ||
text-black | ||
hover:fill-gray-500 | ||
[[open]_&]:fill-gray-500 | ||
cursor-pointer | ||
flex | ||
items-center | ||
" | ||
title="<%= @text || t(".more") %>" | ||
data-action="keydown.esc-><%= stimulus_id %>#close" | ||
> | ||
<% if @text %> | ||
<%= @text %> | ||
<%= icon_tag "arrow-down-s-fill", class: SIZES.fetch(@size) %> | ||
<% else %> | ||
<%= icon_tag "more-line", class: SIZES.fetch(@size) %> | ||
<% end %> | ||
</summary> | ||
|
||
<div | ||
class=" | ||
absolute | ||
border | ||
border-gray-100 | ||
mt-0.5 | ||
flex | ||
flex-col | ||
min-w-[10rem] | ||
p-2 | ||
rounded-sm | ||
shadow-lg | ||
bg-white | ||
z-10 | ||
<%= DIRECTIONS.fetch(@direction) %> | ||
[&>*]:p-2 | ||
[&>*]:rounded-sm | ||
[&>*:hover]:bg-gray-50 | ||
[&>*]:text-black | ||
[&>*]:min-w-fit | ||
" | ||
> | ||
<%= content %> | ||
</div> | ||
</details> |
16 changes: 16 additions & 0 deletions
16
admin/app/components/solidus_admin/ui/dropdown/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
import { useClickOutside } from 'stimulus-use' | ||
|
||
export default class extends Controller { | ||
connect() { | ||
useClickOutside(this) | ||
} | ||
|
||
clickOutside() { | ||
this.close() | ||
} | ||
|
||
close() { | ||
this.element.removeAttribute('open') | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
admin/app/components/solidus_admin/ui/dropdown/component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::UI::Dropdown::Component < SolidusAdmin::BaseComponent | ||
DIRECTIONS = { | ||
left: "right-0", | ||
right: "left-0", | ||
} | ||
|
||
SIZES = { | ||
s: "w-5 h-5", | ||
m: "w-[22px] h-[22px]", | ||
} | ||
|
||
def initialize(text: nil, size: :m, direction: :left, **attributes) | ||
@text = text | ||
@size = size | ||
@attributes = attributes | ||
@direction = direction | ||
|
||
@attributes[:"data-controller"] = "#{stimulus_id} #{attributes[:"data-controller"]}" | ||
@attributes[:"data-action"] = "turbo:before-cache@window->#{stimulus_id}#close #{attributes[:"data-action"]}" | ||
@attributes[:class] = " | ||
#{@size == :m ? 'body-text' : 'body-small'} | ||
#{@attributes[:class]} | ||
" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
en: | ||
more: "More" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.