Skip to content

Commit

Permalink
direction
Browse files Browse the repository at this point in the history
  • Loading branch information
Max You authored and Max You committed Jun 9, 2023
1 parent 306c63e commit 39968fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/sdk/src/fragment-components/a-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export const ATooltipSettingsUI = ({ selectedComponent, setComponent }: any) =>

return <>
<Dropdown
id='placement'
id='direction'
label='Placement of the pop up'
titleText='Placement'
items={placements}
selectedItem={placements.find(item => item.id === selectedComponent.placement)}
selectedItem={placements.find(item => item.id === selectedComponent.direction)}
itemToString={(item: any) => (item ? item.text : '')}
onChange={(event: any) => setComponent({
...selectedComponent,
placement: event.selectedItem.id
direction: event.selectedItem.id
})} />
<Dropdown
id='alignment'
Expand Down Expand Up @@ -98,7 +98,7 @@ export const ATooltip = ({
<Tooltip
className={css`${styleObjectToString(componentObj.style)}`}
triggerText={componentObj.triggerText}
direction={componentObj.placement}
direction={componentObj.direction}
align={componentObj.alignment}>
{componentObj.description}
</Tooltip>
Expand Down Expand Up @@ -126,7 +126,7 @@ export const componentInfo: ComponentInfo = {
angular: {
inputs: ({ json }) => `@Input() ${nameStringToVariableString(json.codeContext?.name)}Description = "${json.description}";
@Input() ${nameStringToVariableString(json.codeContext?.name)}TriggerText = "${json.triggerText}";
@Input() ${nameStringToVariableString(json.codeContext?.name)}Direction = "${json.placement}";`,
@Input() ${nameStringToVariableString(json.codeContext?.name)}Direction = "${json.direction}";`,
outputs: () => '',
imports: ['TooltipModule'],
code: ({ json }) => `<div class="bx--tooltip__label">
Expand All @@ -135,7 +135,7 @@ export const componentInfo: ComponentInfo = {
${angularClassNamesFromComponentObj(json)}
[ibmTooltip]="${nameStringToVariableString(json.codeContext?.name)}Description"
trigger="click"
${json.placement ? `[placement]='${nameStringToVariableString(json.codeContext?.name)}Direction` : ''}>
${json.direction ? `[direction]='${nameStringToVariableString(json.codeContext?.name)}Direction` : ''}>
<div role="button">
<svg ibmIcon="information--filled" size="16"></svg>
</div>
Expand All @@ -150,7 +150,7 @@ export const componentInfo: ComponentInfo = {
className="tooltip-trigger"
triggerText="${json.triggerText}"
${json.alignment ? `align="${json.alignment}"` : ''}
${json.placement ? `direction="${json.placement}"` : ''}>
${json.direction ? `direction="${json.direction}"` : ''}>
${json.description}
</Tooltip>`
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui-fragment/src/components/ui-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { stringToCssClassName } from '../utils';

export interface TooltipState {
type: string;
placement?: string;
direction?: string;
alignment?: string;
description: string | number;
triggerText: string;
Expand Down Expand Up @@ -36,7 +36,7 @@ export const UITooltip = ({ state }: {
}
return <Tooltip
description={state.description}
direction={state.placement ? state.placement : 'top'}
direction={state.direction ? state.direction : 'top'}
align={state.alignment ? state.alignment : 'center'}
name={state.codeContext?.name}
triggerText={state.triggerText}
Expand Down

0 comments on commit 39968fb

Please sign in to comment.