Skip to content

Commit

Permalink
feat: added subtitle to ModalHeader and style prop to MenuItem and Bu…
Browse files Browse the repository at this point in the history
…ttonGroup
  • Loading branch information
soslayando committed Oct 18, 2024
1 parent 67d4d86 commit d3a7239
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
7 changes: 6 additions & 1 deletion packages/core/src/components/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ButtonGroupIconButton,
ButtonGroupItem,
} from './components';
import { mergeStyles } from '../../helpers';

export interface ButtonGroupProps
extends Omit<FlexProps, 'children'>,
Expand All @@ -36,6 +37,7 @@ export const InternalButtonGroup: React.FC<ButtonGroupProps> = ({
inline = true,
justifyContent = 'center',
size = 'md',
style,
visibilityTrigger,
...restFlexProps
}) => {
Expand All @@ -49,7 +51,10 @@ export const InternalButtonGroup: React.FC<ButtonGroupProps> = ({
gap={gap || `cmp-${FLEX_SPACING_SIZE_MAP[size]}`}
justifyContent={justifyContent}
inline={inline}
style={buttonGroupMixin({ hidden, theme, visibilityTrigger })}
style={mergeStyles(
buttonGroupMixin({ hidden, theme, visibilityTrigger }),
style,
)}
>
{React.Children.map(children, (child, idx) => {
const baseChild = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import type {
import {
IButtonAttrs,
IDataAttrs,
IFieldAttrs,
Expand All @@ -11,6 +11,7 @@ import type {
ILinkAttrs,
IMouseEventAttrs,
INavigationAriaAttrs,
IStyledOverloadCss,
IStyledPolymorphic,
ITriggerAriaAttrs,
} from '../../../../../../declarations';
Expand All @@ -22,6 +23,7 @@ import { StyledMenuItem } from './StyledMenuItem';

export interface MenuItemContainerProps
extends IStyledPolymorphic,
IStyledOverloadCss,
IGlobalAttrs,
IDataAttrs,
IFieldAttrs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { ModalContext } from '../../context';
import { Panel, type PanelHeaderProps } from '../../../Panel';
import { Flex } from '../../../Flex';
import { ModalIcon } from '../ModalIcon';
import { Heading } from '../../../Typography/components/Heading';
import { Heading } from '../../../Typography/components';
import { ButtonGroup } from '../../../ButtonGroup';
import { IconButtonClose } from '../../../IconButton';
import { mergeStyles } from '../../../../helpers';
import { Typography } from '../../../Typography';
import { VFlex } from '../../../VFlex';

export interface ModalHeaderProps
extends Pick<
Expand All @@ -20,6 +22,7 @@ export interface ModalHeaderProps
| 'children'
| 'removeSpace'
| 'style'
| 'subtitle'
| 'title'
| 'titleTooltip'
> {
Expand All @@ -35,6 +38,7 @@ export const ModalHeader: React.FC<ModalHeaderProps> = ({
removeSpace,
status,
style,
subtitle,
title,
titleTooltip,
}) => {
Expand All @@ -54,15 +58,24 @@ export const ModalHeader: React.FC<ModalHeaderProps> = ({
<Flex alignItems="center">
<Flex alignItems="inherit">
<ModalIcon status={evalStatus} />
<Heading
size={evalStatus === 'base' ? 'h4' : 'h5'}
truncateLine={1}
tooltip={
titleTooltip || (typeof title === 'string' ? title : null)
}
>
{title}
</Heading>
<VFlex spacing="cmp-xxs">
{title && (
<Heading
size={evalStatus === 'base' ? 'h4' : 'h5'}
truncateLine={1}
tooltip={
titleTooltip || (typeof title === 'string' ? title : null)
}
>
{title}
</Heading>
)}
{subtitle && (
<Typography.Paragraph colorScheme="weak" truncateLine={2}>
{subtitle}
</Typography.Paragraph>
)}
</VFlex>
</Flex>
<Flex marginLeft="auto">
<ButtonGroup size="sm">
Expand Down

0 comments on commit d3a7239

Please sign in to comment.