Skip to content

Commit

Permalink
revert: "chore: Underline styles for popover text trigger (#3060)" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
georgylobko authored Jan 27, 2025
1 parent 0be1ec7 commit c204e53
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 34 deletions.
1 change: 0 additions & 1 deletion pages/popover/text-wrap.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const triggerPermutations = createPermutations<PopoverProps & { size: PopoverPro
'Reallylongpopovercontentwithalotoftextbutnospacesthatwillprobablyoverflowthepopovertrigger',
],
wrapTriggerText: [true, false],
triggerType: ['text', 'text-inline'],
},
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12178,15 +12178,13 @@ that don't have visible text, and to distinguish between multiple triggers with
{
"defaultValue": "'text'",
"description": "Specifies the type of content inside the trigger region. The following types are available:
- \`text\` - Use for triggers containing inline components, like status indicator.
- \`text-inline\` - Use for triggers containing plain text only.
- \`text\` - Use for inline text triggers.
- \`custom\` - Use for the [button](/components/button/) component.",
"inlineType": {
"name": "PopoverProps.TriggerType",
"type": "union",
"values": [
"text",
"text-inline",
"custom",
],
},
Expand Down
5 changes: 2 additions & 3 deletions src/popover/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export interface PopoverProps extends BaseComponentProps {

/**
* Specifies the type of content inside the trigger region. The following types are available:
* - `text` - Use for triggers containing inline components, like status indicator.
* - `text-inline` - Use for triggers containing plain text only.
* - `text` - Use for inline text triggers.
* - `custom` - Use for the [button](/components/button/) component.
*/
triggerType?: PopoverProps.TriggerType;
Expand Down Expand Up @@ -115,7 +114,7 @@ export type Rect = BoundingBox & {
export namespace PopoverProps {
export type Position = 'top' | 'right' | 'bottom' | 'left';
export type Size = 'small' | 'medium' | 'large';
export type TriggerType = 'text' | 'text-inline' | 'custom';
export type TriggerType = 'text' | 'custom';

export interface Ref {
/**
Expand Down
4 changes: 2 additions & 2 deletions src/popover/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function InternalPopover(
const [visible, setVisible] = useState(false);

const focusTrigger = useCallback(() => {
if (['text', 'text-inline'].includes(triggerType)) {
if (triggerType === 'text') {
triggerRef.current?.focus();
} else {
triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();
Expand Down Expand Up @@ -198,7 +198,7 @@ function InternalPopover(
});
}}
>
{['text', 'text-inline'].includes(triggerType) ? (
{triggerType === 'text' ? (
<button
{...triggerProps}
className={clsx(triggerProps.className, wrapTriggerText === false && styles['overflow-ellipsis'])}
Expand Down
26 changes: 1 addition & 25 deletions src/popover/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
@import './container';
@import './motion';

$trigger-underline-offset: 0.25em;

.root {
@include styles.styles-reset;
color: inherit;
Expand All @@ -38,31 +36,8 @@ $trigger-underline-offset: 0.25em;
@include styles.text-wrapping;
}

.trigger-type-text-inline {
border-block: 0;
/*
This transparent border is necessary to maintain space between the trigger and the bottom-positioned popover.
*/
border-block-end: awsui.$border-divider-list-width dashed transparent;
text-decoration: underline dashed currentColor;
text-decoration-thickness: awsui.$border-divider-list-width;
text-underline-offset: $trigger-underline-offset;

&.overflow-ellipsis {
/*
This line-height needs to be overridden because the overflow: hidden would otherwise conceal the underline styles.
*/
line-height: calc(1 + #{$trigger-underline-offset} + #{awsui.$border-divider-list-width});
}
}

.trigger-type-text {
border-block: 0;
border-block-end: awsui.$border-divider-list-width dashed currentColor;
}

.trigger-type-text-inline,
.trigger-type-text {
border-inline: 0;
margin-block: 0;
margin-inline: 0;
Expand All @@ -71,6 +46,7 @@ $trigger-underline-offset: 0.25em;
background-color: transparent;

cursor: pointer;
border-block-end: awsui.$border-divider-list-width dashed currentColor;

&:focus {
outline: none;
Expand Down

0 comments on commit c204e53

Please sign in to comment.