-
Notifications
You must be signed in to change notification settings - Fork 56
[Prototype] Fix sprite item title width #3203
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
Open
qingqing-ux
wants to merge
13
commits into
goplus:ui
Choose a base branch
from
qingqing-ux:codex/fix-prototype-sprite-title-width
base: ui
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a332165
Fix prototype sprite item title width
qingqing-ux 693c5f5
Fit hidden icon to sprite title size
qingqing-ux 9d6eaff
Align prototype UI block item paths
qingqing-ux 9db41ce
Align suffix title text to left
qingqing-ux 611752c
Start suffix title text at container edge
qingqing-ux d9b6ea7
Render full sprite names before truncation
qingqing-ux d7a0c66
Make medium sprite titles use full width
qingqing-ux 10405d1
Default sprite item visibility to neutral
qingqing-ux da623ca
Use block title for prototype backdrop items
qingqing-ux 1f505db
Skip GHCR login for non-publish builds
qingqing-ux 6c31688
Address prototype UI review comments
qingqing-ux ecf6541
Refine prototype title row sizing
qingqing-ux 96c5443
Keep prototype item title alignment consistent
qingqing-ux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
36 changes: 21 additions & 15 deletions
36
...rc/components/editor/UIBlockItemTitle.vue → ...nents/ui/block-items/UIBlockItemTitle.vue
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,31 @@ | ||
| <template> | ||
| <div :class="rootClass"> | ||
| <span class="min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap" :title="title"> | ||
| <slot></slot> | ||
| </span> | ||
| <slot v-if="slots.suffix != null" name="suffix"></slot> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed, useSlots } from 'vue' | ||
|
|
||
| import { cn, type ClassValue } from '../utils' | ||
|
|
||
| const props = defineProps<{ | ||
| size: 'medium' | 'large' | ||
| title: string | ||
| class?: string | ||
| class?: ClassValue | ||
| }>() | ||
|
|
||
| const slots = useSlots() | ||
| const rootClass = computed(() => [ | ||
| 'flex w-full items-center gap-2 px-1.5 text-center text-title', | ||
| props.size === 'large' ? 'h-5 text-sm' : 'h-5.5 text-2xs', | ||
| props.class | ||
| ]) | ||
| const rootClass = computed(() => | ||
| cn( | ||
| 'flex items-center text-title', | ||
| props.size === 'large' | ||
| ? 'h-5 w-full gap-2 px-1.5 text-center text-sm' | ||
| : 'h-5.5 w-full gap-0.5 px-1 text-center text-2xs', | ||
| props.class | ||
| ) | ||
| ) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div :class="rootClass"> | ||
| <span class="min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap" :title="title"> | ||
| <slot></slot> | ||
| </span> | ||
| <slot v-if="slots.suffix != null" name="suffix"></slot> | ||
| </div> | ||
| </template> |
22 changes: 22 additions & 0 deletions
22
ui/prototype/src/components/ui/block-items/UIEditorBackdropItem.vue
This file contains hidden or 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,22 @@ | ||
| <template> | ||
| <UIBlockItem :active="selected"> | ||
| <div class="mt-0.5 flex min-h-0 w-full flex-col items-center"> | ||
| <img class="h-15 w-20 rounded-[4px] object-cover" :src="imgSrc" :alt="name" /> | ||
| </div> | ||
| <UIBlockItemTitle size="medium" :title="name"> | ||
| {{ name }} | ||
| </UIBlockItemTitle> | ||
| <slot></slot> | ||
| </UIBlockItem> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import UIBlockItem from '@/components/ui/block-items/UIBlockItem.vue' | ||
| import UIBlockItemTitle from '@/components/ui/block-items/UIBlockItemTitle.vue' | ||
|
|
||
| defineProps<{ | ||
| imgSrc: string | ||
| name: string | ||
| selected?: boolean | ||
| }>() | ||
| </script> |
This file contains hidden or 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 hidden or 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,31 @@ | ||
| <template> | ||
| <!-- eslint-disable-next-line vue/no-v-html --> | ||
| <div :class="rootClass" :data-icon-type="type" v-html="typeIconMap[type]"></div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
|
|
||
| import { cn, type ClassValue } from '../utils' | ||
| import eyeOff from './eye-off.svg?raw' | ||
|
|
||
| const typeIconMap = { | ||
| eyeOff | ||
| } | ||
|
|
||
| export type Type = keyof typeof typeIconMap | ||
|
|
||
| const props = defineProps<{ | ||
| type: Type | ||
| class?: ClassValue | ||
| }>() | ||
|
|
||
| const rootClass = computed(() => cn('ui-icon flex h-4 w-4', props.class)) | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| .ui-icon :deep(svg) { | ||
| width: 100%; | ||
| height: 100%; | ||
| } | ||
| </style> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,28 @@ | ||
| import { twMerge } from 'tailwind-merge' | ||
|
|
||
| export type ClassDictionary = Record<string, boolean | null> | ||
| export type ClassValue = string | ClassDictionary | null | undefined | false | ClassValue[] | ||
|
|
||
| function flattenClassValue(value: ClassValue, tokens: string[]) { | ||
| if (value == null || value === false) return | ||
|
|
||
| if (typeof value === 'string') { | ||
| tokens.push(value) | ||
| return | ||
| } | ||
|
|
||
| if (Array.isArray(value)) { | ||
| for (const item of value) flattenClassValue(item, tokens) | ||
| return | ||
| } | ||
|
|
||
| for (const [className, enabled] of Object.entries(value)) { | ||
| if (enabled === true) tokens.push(className) | ||
| } | ||
| } | ||
|
|
||
| export function cn(...values: ClassValue[]) { | ||
| const tokens: string[] = [] | ||
| for (const value of values) flattenClassValue(value, tokens) | ||
| return twMerge(tokens.join(' ')) | ||
| } |
This file contains hidden or 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 @@ | ||
| export * from './cn' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structural check that
SpriteItem.vueimports and usesUIEditorSpriteItem(rather than duplicating its own hidden-icon layout) was a valid regression guard — the regression it prevented was precisely the one that necessitated PR #3198. It was removed alongside the bad CSS checks, but the two concerns are independent. Worth restoring just the structural checks here: