Skip to content

Commit

Permalink
Docs(web-twig): Showcase placement valuse on Tooltip demo
Browse files Browse the repository at this point in the history
refs #DS-923
  • Loading branch information
literat committed Nov 3, 2023
1 parent debd515 commit 4957018
Showing 1 changed file with 35 additions and 35 deletions.
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>

0 comments on commit 4957018

Please sign in to comment.