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(date-range-picker): mini #1434

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions .changeset/thick-lamps-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@wizleap-inc/wiz-ui-react": minor
"@wizleap-inc/wiz-ui-next": minor
"@wizleap-inc/wiz-ui-styles": minor
---

Feat(date-range-picker): mini
10 changes: 9 additions & 1 deletion packages/styles/bases/date-range-picker.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ const BORDER_WIDTH = "1px";
const baseBodyStyle = style({
borderRadius: THEME.spacing.xs2,
boxSizing: "border-box",
padding: `calc(${THEME.spacing.xs} - ${BORDER_WIDTH}) ${THEME.spacing.xs}`,
fontSize: THEME.fontSize.sm,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
});

export const variantStyles = styleVariants({
regular: {
padding: `calc(${THEME.spacing.xs} - ${BORDER_WIDTH}) ${THEME.spacing.xs}`,
},
mini: {
padding: `1px ${THEME.spacing.xs2}`,
},
});
Comment on lines +15 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

miniのデザインにて、横方向のpaddingがfigmaよりも狭いです!

vue/react
スクリーンショット 2025-01-10 10 43 19

figma(おそらくfigmaは高さをline-heightで調整しているのであれですが、横方向については影響はないはず)
image


export const bodyStyle = styleVariants({
active: [
baseBodyStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ IsDirectionFixed.parameters = {
},
};

export const Mini = Template.bind({});
Mini.args = {
modelValue: {
start: new Date(2020, 0, 15),
end: new Date(2020, 1, 15),
},
isDirectionFixed: true,
variant: "mini",
};

const _formatDateJp = (date: Date) =>
`${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`;

Expand Down
Copy link
Collaborator

@ichi-h ichi-h Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

起こり得ない挙動ではあるのですが、vueのstoryにてvariantの文字列指定にすると、「mini」「regular」 「(空文字列)」 ですべてスタイルが異なるみたいです……笑

regular
スクリーンショット 2025-01-10 10 40 58

mini(figmaよりも横方向のpaddingが狭い)
スクリーンショット 2025-01-10 10 41 11

(空文字列)(これが想定しているminiのデザイン)
スクリーンショット 2025-01-10 10 41 21

(vueのstoryのvariantをセレクタにすれば回避可能)

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<button
type="button"
:class="[
styles.variantStyles[variant],
styles.bodyStyle[disabled ? 'disabled' : 'active'],
styles.widthStyle[expand ? 'expanded' : 'default'],
inputBorderStyle[borderState],
Expand Down Expand Up @@ -223,6 +224,11 @@ const props = defineProps({
type: String,
required: false,
},
variant: {
type: String as PropType<"regular" | "mini">,
required: false,
default: "regular",
},
/**
* カレンダー(Popup)の開閉状態を指定します。
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Props = BaseProps & {
selectBoxOptions?: DateRangePickerSelectBoxOption[];
selectBoxValue?: string;
isDirectionFixed?: boolean;
variant?: "regular" | "mini";
error?: boolean;
_today?: Date;
onChangeDateRange?: (dateRange: DateRange) => void;
Expand All @@ -63,6 +64,7 @@ const DateRangePicker: FC<Props> = ({
selectBoxOptions,
selectBoxValue,
isDirectionFixed = false,
variant = "regular",
error,
_today,
onChangeDateRange,
Expand Down Expand Up @@ -233,6 +235,7 @@ const DateRangePicker: FC<Props> = ({
className={clsx(
className,
styles.bodyStyle[disabled ? "disabled" : "active"],
styles.variantStyles[variant],
styles.widthStyle[expand ? "expanded" : "default"],
inputBorderStyle[borderStyle]
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ export const InitialValueStart: Story = {
},
};

export const Mini: Story = {
args: {
dateRange: {
start: new Date(2000, 0, 15),
end: null,
},
variant: "mini",
},
};

export const Playground: Story = {
args: {
selectBoxOptions: [
Expand Down
Loading