-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs(web-twig): Showcase placement valuse on Tooltip demo
refs #DS-923
- Loading branch information
Showing
1 changed file
with
35 additions
and
35 deletions.
There are no files selected for viewing
70 changes: 35 additions & 35 deletions
70
packages/web-twig/src/Resources/components/Tooltip/stories/TooltipPlacements.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
<form autocomplete="off" class="mx-auto"> | ||
<Grid cols="3" UNSAFE_style="align-items: center; justify-items: center"> | ||
<div style="grid-row: 1; grid-column: 2"> | ||
<DocsStack stackalignment="stretch"> | ||
<form autocomplete="off"> | ||
<Grid cols="3" UNSAFE_className="mx-auto" UNSAFE_style="align-items: center; justify-items: center; max-width: 30rem;"> | ||
<div style="grid-row: 1; grid-column: 2"> | ||
|
||
<Radio name="placement" isLabelHidden value="topLeft" id="placement_top_left" label="top-left" /> | ||
<Radio name="placement" isLabelHidden value="top" id="placement_top" label="top" /> | ||
<Radio name="placement" isLabelHidden value="topRight" id="placement_top_right" label="top-right" /> | ||
<Radio name="placement" islabelhidden value="topLeft" id="placement_top_left" label="top-left"/> | ||
<Radio name="placement" islabelhidden value="top" id="placement_top" label="top"/> | ||
<Radio name="placement" islabelhidden value="topRight" id="placement_top_right" label="top-right"/> | ||
|
||
</div> | ||
<div style="grid-row: 3; grid-column: 2"> | ||
</div> | ||
<div style="grid-row: 3; grid-column: 2"> | ||
|
||
<Radio name="placement" isLabelHidden value="bottomLeft" id="placement_bottom_left" label="bottom-left" /> | ||
<Radio name="placement" isLabelHidden value="bottom" id="placement_bottom" label="bottom" isChecked /> | ||
<Radio name="placement" isLabelHidden value="bottomRight" id="placement_bottom_right" label="bottom-right" /> | ||
<Radio name="placement" islabelhidden value="bottomLeft" id="placement_bottom_left" label="bottom-left"/> | ||
<Radio name="placement" islabelhidden value="bottom" id="placement_bottom" label="bottom" ischecked/> | ||
<Radio name="placement" islabelhidden value="bottomRight" id="placement_bottom_right" label="bottom-right"/> | ||
|
||
</div> | ||
<div style="display: flex; flex-direction: column; grid-row: 2; grid-column: 1"> | ||
</div> | ||
<div style="display: flex; flex-direction: column; grid-row: 2; grid-column: 1; justify-self: start;"> | ||
|
||
<Radio name="placement" isLabelHidden value="leftTop" id="placement_left_top" label="left-top" /> | ||
<Radio name="placement" isLabelHidden value="left" id="placement_left" label="left" /> | ||
<Radio name="placement" isLabelHidden value="leftBottom" id="placement_left_bottom" label="left-bottom" /> | ||
<Radio name="placement" islabelhidden value="leftTop" id="placement_left_top" label="left-top"/> | ||
<Radio name="placement" islabelhidden value="left" id="placement_left" label="left"/> | ||
<Radio name="placement" islabelhidden value="leftBottom" id="placement_left_bottom" label="left-bottom"/> | ||
|
||
</div> | ||
<div style="display: flex; flex-direction: column; grid-row: 2; grid-column: 3"> | ||
</div> | ||
<div style="display: flex; flex-direction: column; grid-row: 2; grid-column: 3; justify-self: end;"> | ||
|
||
<Radio name="placement" isLabelHidden value="rightTop" id="placement_right_top" label="right-top" /> | ||
<Radio name="placement" isLabelHidden value="right" id="placement_right" label="right" /> | ||
<Radio name="placement" isLabelHidden value="rightBottom" id="placement_right_bottom" label="right-bottom" /> | ||
<Radio name="placement" islabelhidden value="rightTop" id="placement_right_top" label="right-top"/> | ||
<Radio name="placement" islabelhidden value="right" id="placement_right" label="right"/> | ||
<Radio name="placement" islabelhidden value="rightBottom" id="placement_right_bottom" label="right-bottom"/> | ||
|
||
</div> | ||
<div style="grid-row: 2; grid-column: 2"> | ||
</div> | ||
<div style="grid-row: 2; grid-column: 2"> | ||
|
||
<TooltipWrapper UNSAFE_style="margin: 6rem auto"> | ||
<DocsBox>Click the dots!</DocsBox> | ||
<Tooltip id="tooltip_placements_example">Hello!</Tooltip> | ||
</TooltipWrapper> | ||
<TooltipWrapper UNSAFE_style="margin: 5rem auto"> | ||
<DocsBox UNSAFE_className="px-900 py-900">Click the dots!</DocsBox> | ||
<Tooltip id="tooltip_placements_example">bottom</Tooltip> | ||
</TooltipWrapper> | ||
|
||
</div> | ||
</Grid> | ||
</form> | ||
|
||
<script> | ||
const radios = document.querySelectorAll('input[type="radio"]'); | ||
</div> | ||
</Grid> | ||
</form> | ||
</DocsStack<script> | ||
const radios = document.querySelectorAll('input[type="radio"]'); | ||
|
||
radios.forEach(radio => { | ||
radio.addEventListener('change', () => { | ||
const placement = radio.value; | ||
const tooltip = document.getElementById('tooltip_placements_example'); | ||
|
||
tooltip.textContent = placement.split(/(?=[A-Z])/).join('-').toLowerCase(); | ||
tooltip.classList.replace(tooltip.classList[1], `Tooltip--${placement}`); | ||
}); | ||
}); | ||
</script> | ||
});</script> |