Skip to content

Commit

Permalink
chore(Button): icon spacing alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
zettca committed Nov 6, 2024
1 parent 63ed94d commit fa98a98
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 39 deletions.
2 changes: 1 addition & 1 deletion docs/tests/Components.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const Test: StoryObj = {
style={{ alignItems: "start", justifyContent: "start" }}
>
<div>
<div style={{ display: "flex", height: 180 }}>
<div className="flex justify-between h-180px">
{renderStory(AccordionDisabledStory, context)}
{renderStory(DotPaginationMainStory, context)}
{renderStory(DropDownMenuMainStory, context)}
Expand Down
14 changes: 13 additions & 1 deletion packages/core/src/Badge/Badge.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@ import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

export const { staticClasses, useClasses } = createClasses("HvBadge", {
root: { position: "relative", "&>*": { float: "left" } },
root: {
position: "relative",
"&>*": { float: "left" },
":has($badgeIcon)": {
width: "fit-content",
height: "fit-content",
"&>div:first-child": {
minWidth: 32,
minHeight: 32,
"--icsize": "100%",
},
},
},
/** class applied to the badge container when it has content */
badgeContainer: { width: 0 },
/** class applied to the badge */
Expand Down
13 changes: 4 additions & 9 deletions packages/core/src/DotPagination/DotPagination.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const meta: Meta<typeof HvDotPagination> = {
export default meta;

const styles = {
container: css({ width: "100%", justifyContent: "center" }),
page: css({ textAlign: "center" }),
};

Expand All @@ -42,10 +41,8 @@ export const Main: StoryObj<HvDotPaginationProps> = {
];

return (
<div className={styles.container}>
<div className={styles.page}>
<HvTypography>{pages[page]}</HvTypography>
</div>
<div>
<HvTypography className={styles.page}>{pages[page]}</HvTypography>
<br />
<HvDotPagination
page={page}
Expand Down Expand Up @@ -110,10 +107,8 @@ export const CustomizedDotPagination: StoryObj<HvDotPaginationProps> = {
};

return (
<div className={styles.container}>
<div className={styles.page}>
<HvTypography>{pages[page]}</HvTypography>
</div>
<div>
<HvTypography className={styles.page}>{pages[page]}</HvTypography>
<br />
<HvDotPagination
classes={dotpaginationStyle}
Expand Down
8 changes: 1 addition & 7 deletions packages/core/src/InlineEditor/InlineEditor.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ export const { staticClasses, useClasses } = createClasses("HvInlineEditor", {
cursor: "pointer",
visibility: "hidden",
alignSelf: "center",
height: "16px",
width: "32px",
minWidth: "32px",

"& svg": {
margin: theme.spacing(0, "xs"),
},
minWidth: 16,
},
iconVisible: {
visibility: "visible",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@ export const { staticClasses, useClasses } = createClasses(
height: "32px",
color: "inherit",
fontWeight: "inherit",
padding: 0,
padding: theme.spacing(0, "xs"),
border: "none",

// cursor
"& *": {
cursor: "pointer",
},
},
noIcon: {
paddingLeft: theme.space.xs,
},
noIcon: {},
minimized: {
justifyContent: "center",
paddingRight: 0,
padding: 0,
},
},
);
3 changes: 2 additions & 1 deletion packages/core/src/VerticalNavigation/Actions/Action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const HvVerticalNavigationAction = (
id={setId(id, "button")}
variant="secondaryGhost"
icon={!isOpen}
startIcon={isOpen && icon}
className={cx(
classes.action,
{
Expand All @@ -55,7 +56,7 @@ export const HvVerticalNavigationAction = (
{...(!isOpen && { "aria-label": label })}
{...others}
>
{icon}
{!isOpen && icon}
{isOpen && label}
</HvButton>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { createClasses } from "@hitachivantara/uikit-react-core";
import { createClasses, theme } from "@hitachivantara/uikit-react-core";

export const { staticClasses, useClasses } = createClasses("HvStep", {
root: {},
ghost: {
fontWeight: theme.fontWeights.semibold,
"&:hover": {
backgroundColor: "transparent",
},
Expand Down
23 changes: 9 additions & 14 deletions packages/lab/src/StepNavigation/DefaultNavigation/Step/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
ExtractNames,
HvAvatar,
HvBaseProps,
HvButton,
HvButtonProps,
HvButtonBase,
HvButtonBaseProps,
HvSize,
} from "@hitachivantara/uikit-react-core";
import {
Expand All @@ -20,7 +20,7 @@ import { useClasses } from "./Step.styles";
type HvStepClasses = ExtractNames<typeof useClasses>;

export interface HvStepProps
extends Pick<HvButtonProps, "onClick">,
extends Pick<HvButtonBaseProps, "onClick">,
Omit<HvBaseProps, "onClick"> {
/** A Jss Object used to override or extend the styles applied to the empty state StepNavigation. */
classes?: HvStepClasses;
Expand Down Expand Up @@ -92,8 +92,7 @@ export const HvStep = ({

const backgroundColor = getColor(state);

const color = state === "Pending" ? "atmo2" : undefined;
const semantic = state !== "Pending" ? getSemantic(state) : undefined;
const color = state === "Pending" ? "atmo2" : getSemantic(state);
const status = state === "Current" ? "secondary_60" : undefined;
const IconComponent = iconStateObject[state];

Expand All @@ -107,13 +106,11 @@ export const HvStep = ({
className,
)}
>
<HvButton
<HvButtonBase
className={cx(classes.ghost, {
[classes.ghostDisabled]: state === "Current",
})}
aria-label={`${title}`}
icon
overrideIconColors={false}
aria-label={title}
disabled={disabled ?? ["Current", "Disabled"].includes(state)}
onClick={onClick}
>
Expand All @@ -126,16 +123,14 @@ export const HvStep = ({
{IconComponent ? (
<IconComponent
color={color}
semantic={semantic}
width={svgSize}
height={svgSize}
iconSize={iconSize}
style={{ fontSize: svgSize }}
size={iconSize}
/>
) : (
number
)}
</HvAvatar>
</HvButton>
</HvButtonBase>
</div>
);
};

0 comments on commit fa98a98

Please sign in to comment.