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

Feat(search-input): ラベル位置を揃える #1342

Merged
merged 2 commits into from
Jul 22, 2024
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
6 changes: 6 additions & 0 deletions .changeset/sixty-rocks-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wizleap-inc/wiz-ui-next": minor
"@wizleap-inc/wiz-ui-react": minor
---

Feat(search-input): ラベルの位置を揃える
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
align="center"
nowrap
gap="xs2"
:pl="!allOptionsHaveChildren && !singleSelect ? 'lg' : 'no'"
>
<div :class="styles.searchInputLabelStyle">
{{ item.label }}
Expand Down Expand Up @@ -303,6 +304,9 @@ const activeItem = ref<number | null>();
const activeItemIndex = ref<number | null>(null);
const hasFocus = ref(false);
const isBorder = ref(false);
const allOptionsHaveChildren = props.options.every(
(option) => !!option.children
);

const valueToOption = computed(() => {
const map = new Map<number, SearchInputOption>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
align="center"
nowrap
gap="xs2"
:pl="
!allOptionsHaveChildren(option.children) && !singleSelect
? 'lg'
: 'no'
"
>
<div :class="styles.searchInputLabelStyle">
{{ item.label }}
Expand Down Expand Up @@ -192,6 +197,8 @@ const activeItemIndex = ref<number | null>(null);

const ITEM_HEIGHT = 44;
const DIVIDER_HEIGHT = 0.8;
const allOptionsHaveChildren = (options: SearchInputOption[]) =>
options.every((option) => !!option.children);

const checkValues = computed({
get: () => props.modelValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export const SearchPopupPanel: FC<Props> = ({
setActiveValue(null);
}, [options]);

const allOptionsHaveChildren = options.every((option) => !!option.children);

return (
<>
<div
Expand Down Expand Up @@ -99,6 +101,9 @@ export const SearchPopupPanel: FC<Props> = ({
)}
>
<WizHStack
pl={
!allOptionsHaveChildren && !singleSelect ? "lg" : "no"
}
py="xs2"
width="100%"
justify="between"
Expand Down
Loading