Frontend: icon-button Cleanup (#1628)
				
					
				
			Closes #1591 ### Changes - Converts one instance of a button with an icon in it to an `icon-button` - Makes all the trashcan icon buttons have a red hover state - Adds localization function & placeholder to upload dialog "Name" field - Adds localization functions to some missing icon-button label instances - Adds a few missing icon button labels Co-authored-by: sua yoo <sua@suayoo.com> Co-authored-by: sua yoo <sua@webrecorder.org>
This commit is contained in:
		
							parent
							
								
									412eb2ef32
								
							
						
					
					
						commit
						275f69493f
					
				| @ -152,6 +152,7 @@ export class OrgsList extends LiteElement { | |||||||
|           <sl-icon-button |           <sl-icon-button | ||||||
|             name="gear" |             name="gear" | ||||||
|             slot="prefix" |             slot="prefix" | ||||||
|  |             label=${msg("Edit org quotas")} | ||||||
|             @click="${this.showQuotas(org)}" |             @click="${this.showQuotas(org)}" | ||||||
|           ></sl-icon-button> |           ></sl-icon-button> | ||||||
|         </div> |         </div> | ||||||
|  | |||||||
| @ -1,10 +1,12 @@ | |||||||
| import { css, html, LitElement } from "lit"; | import { localized, msg } from "@lit/localize"; | ||||||
|  | import { css, html } from "lit"; | ||||||
| import { | import { | ||||||
|   customElement, |   customElement, | ||||||
|   property, |   property, | ||||||
|   queryAssignedElements, |   queryAssignedElements, | ||||||
| } from "lit/decorators.js"; | } from "lit/decorators.js"; | ||||||
| 
 | 
 | ||||||
|  | import { TailwindElement } from "@/classes/TailwindElement"; | ||||||
| import { truncate } from "@/utils/css"; | import { truncate } from "@/utils/css"; | ||||||
| 
 | 
 | ||||||
| type FileRemoveDetail = { | type FileRemoveDetail = { | ||||||
| @ -15,8 +17,9 @@ export type FileRemoveEvent = CustomEvent<FileRemoveDetail>; | |||||||
| /** | /** | ||||||
|  * @event on-remove FileRemoveEvent |  * @event on-remove FileRemoveEvent | ||||||
|  */ |  */ | ||||||
|  | @localized() | ||||||
| @customElement("btrix-file-list-item") | @customElement("btrix-file-list-item") | ||||||
| export class FileListItem extends LitElement { | export class FileListItem extends TailwindElement { | ||||||
|   static styles = [ |   static styles = [ | ||||||
|     truncate, |     truncate, | ||||||
|     css` |     css` | ||||||
| @ -91,6 +94,8 @@ export class FileListItem extends LitElement { | |||||||
|             ? "" |             ? "" | ||||||
|             : html`<sl-icon-button
 |             : html`<sl-icon-button
 | ||||||
|                 name="trash3" |                 name="trash3" | ||||||
|  |                 class="text-base hover:text-danger" | ||||||
|  |                 label=${msg("Remove file")} | ||||||
|                 @click=${this.onRemove} |                 @click=${this.onRemove} | ||||||
|               ></sl-icon-button>`} |               ></sl-icon-button>`} | ||||||
|         </div> |         </div> | ||||||
| @ -121,7 +126,7 @@ export class FileListItem extends LitElement { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @customElement("btrix-file-list") | @customElement("btrix-file-list") | ||||||
| export class FileList extends LitElement { | export class FileList extends TailwindElement { | ||||||
|   static styles = [ |   static styles = [ | ||||||
|     css` |     css` | ||||||
|       ::slotted(btrix-file-list-item) { |       ::slotted(btrix-file-list-item) { | ||||||
|  | |||||||
| @ -240,7 +240,12 @@ export class FileUploader extends TailwindElement { | |||||||
|     const { helpText, validate } = this.validateDescriptionMax; |     const { helpText, validate } = this.validateDescriptionMax; | ||||||
|     return html` |     return html` | ||||||
|       <div class="mb-3"> |       <div class="mb-3"> | ||||||
|         <sl-input label="Name" name="name" required></sl-input> |         <sl-input | ||||||
|  |           label=${msg("Name")} | ||||||
|  |           name="name" | ||||||
|  |           placeholder=${msg("Our Website (example.com)")} | ||||||
|  |           required | ||||||
|  |         ></sl-input> | ||||||
|       </div> |       </div> | ||||||
|       <sl-textarea |       <sl-textarea | ||||||
|         class="with-max-help-text mb-3" |         class="with-max-help-text mb-3" | ||||||
|  | |||||||
| @ -224,6 +224,7 @@ export class CollectionsAdd extends LiteElement { | |||||||
|         </div> |         </div> | ||||||
|         <sl-icon-button |         <sl-icon-button | ||||||
|           name="x-lg" |           name="x-lg" | ||||||
|  |           label=${msg("Remove from auto-add")} | ||||||
|           data-key=${id} |           data-key=${id} | ||||||
|           ?disabled=${!collection} |           ?disabled=${!collection} | ||||||
|           @click=${this.removeCollection} |           @click=${this.removeCollection} | ||||||
|  | |||||||
| @ -205,12 +205,12 @@ export class QueueExclusionTable extends LiteElement { | |||||||
|           ${this.renderValue({ exclusion, index })} |           ${this.renderValue({ exclusion, index })} | ||||||
|         </td> |         </td> | ||||||
|         <td class="${actionColClass} text-center text-[1rem]"> |         <td class="${actionColClass} text-center text-[1rem]"> | ||||||
|           <btrix-button |           <sl-icon-button | ||||||
|             icon |             label=${msg("Remove exclusion")} | ||||||
|  |             class="text-base hover:text-danger" | ||||||
|  |             name="trash3" | ||||||
|             @click=${() => this.removeExclusion(exclusion, index)} |             @click=${() => this.removeExclusion(exclusion, index)} | ||||||
|           > |           ></sl-icon-button> | ||||||
|             <sl-icon name="trash3"></sl-icon> |  | ||||||
|           </btrix-button> |  | ||||||
|         </td> |         </td> | ||||||
|       </tr> |       </tr> | ||||||
|     `;
 |     `;
 | ||||||
|  | |||||||
| @ -85,7 +85,7 @@ export class Dashboard extends LiteElement { | |||||||
|               href=${`${this.orgBasePath}/settings`} |               href=${`${this.orgBasePath}/settings`} | ||||||
|               class="text-lg" |               class="text-lg" | ||||||
|               name="gear" |               name="gear" | ||||||
|               label="Edit org settings" |               label=${msg("Edit org settings")} | ||||||
|               @click=${this.navLink} |               @click=${this.navLink} | ||||||
|             ></sl-icon-button>`, |             ></sl-icon-button>`, | ||||||
|         )} |         )} | ||||||
|  | |||||||
| @ -362,8 +362,10 @@ export class OrgSettings extends LiteElement { | |||||||
|         disableButton = true; |         disableButton = true; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     return html`<btrix-button
 |     return html`<sl-icon-button
 | ||||||
|       icon |       class="text-base hover:text-danger" | ||||||
|  |       name="trash3" | ||||||
|  |       label=${msg("Remove org member")} | ||||||
|       ?disabled=${disableButton} |       ?disabled=${disableButton} | ||||||
|       aria-details=${ifDefined( |       aria-details=${ifDefined( | ||||||
|         disableButton ? msg("Cannot remove only admin member") : undefined, |         disableButton ? msg("Cannot remove only admin member") : undefined, | ||||||
| @ -374,9 +376,7 @@ export class OrgSettings extends LiteElement { | |||||||
|             detail: { member }, |             detail: { member }, | ||||||
|           }) as OrgRemoveMemberEvent, |           }) as OrgRemoveMemberEvent, | ||||||
|         )} |         )} | ||||||
|     > |     ></sl-icon-button>`; | ||||||
|       <sl-icon name="trash3"></sl-icon> |  | ||||||
|     </btrix-button>`; |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   private renderRemoveInviteButton(invite: Invite) { |   private renderRemoveInviteButton(invite: Invite) { | ||||||
|  | |||||||
| @ -488,7 +488,7 @@ export class WorkflowDetail extends LiteElement { | |||||||
|       return html` <h3>${this.tabLabels[this.activePanel]}</h3>
 |       return html` <h3>${this.tabLabels[this.activePanel]}</h3>
 | ||||||
|         <sl-icon-button |         <sl-icon-button | ||||||
|           name="gear" |           name="gear" | ||||||
|           label="Edit workflow settings" |           label=${msg("Edit workflow settings")} | ||||||
|           @click=${() => |           @click=${() => | ||||||
|             this.navTo( |             this.navTo( | ||||||
|               `/orgs/${this.appState.orgSlug}/workflows/crawl/${this.workflow?.id}?edit`, |               `/orgs/${this.appState.orgSlug}/workflows/crawl/${this.workflow?.id}?edit`, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user