Skip to content

Commit

Permalink
feat: add autoPositionDisable prop [MDS-839]
Browse files Browse the repository at this point in the history
  • Loading branch information
yarema184 committed Nov 27, 2023
1 parent 6d2c2a5 commit 82be643
Show file tree
Hide file tree
Showing 7 changed files with 6,775 additions and 221 deletions.
14 changes: 14 additions & 0 deletions next-docs/pages/components/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ComponentPageDescription from '../../components/ComponentPageDescription'
import type { ComponentNames } from '../../components/getComponent';
import Layout from '../../components/Layout';
import PropsTable from '../../components/PropsTable';
import AutoPositionDisable from '../../public/examples/popover/AutoPositionDisable';
import Default from '../../public/examples/popover/Default';
import Position from '../../public/examples/popover/Position';
import TooltipView from '../../public/examples/popover/TooltipView';
Expand Down Expand Up @@ -80,6 +81,12 @@ const PagePopover = () => {
code={examples ? examples.TooltipView : 'Loading'}
/>

<Preview
title="Disable flip on component"
preview={<AutoPositionDisable />}
code={examples ? examples.AutoPositionDisable : 'Loading'}
/>

<PropsTable
title="Popover"
data={[
Expand All @@ -90,6 +97,13 @@ const PagePopover = () => {
default: 'bottom',
description: 'Set placement for popover',
},
{
name: 'autoPositionDisable',
type: 'boolean',
required: false,
default: 'false',
description: 'Disable flip on component',
},
{
name: 'Render Props: ',
type: '',
Expand Down
50 changes: 50 additions & 0 deletions next-docs/public/examples/popover/AutoPositionDisable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react';
import { Popover, Button, MenuItem } from '@heathmont/moon-core-tw';
import { OtherFrame } from '@heathmont/moon-icons-tw';

const Example = () => {
return (
<Popover autoPositionDisable={true}>
<Popover.Trigger>
<Button>Toggle Popover</Button>
</Popover.Trigger>
<Popover.Panel className="p-2 flex flex-col gap-1">
<Content />
</Popover.Panel>
</Popover>
);
};

const Content: React.FC = () => (
<>
<MenuItem>
<span className="flex w-11 h-11 bg-gohan items-center justify-center rounded-lg">
<OtherFrame className="text-bulma text-moon-24" />
</span>
<MenuItem.MultiTitle
title="Tournaments"
text={<span>Best tournaments with streamers</span>}
/>
</MenuItem>
<MenuItem>
<span className="flex w-11 h-11 bg-gohan items-center justify-center">
<OtherFrame className="text-bulma text-moon-24" />
</span>
<MenuItem.MultiTitle
title="Promotions"
text={<span> Your favourite games</span>}
/>
</MenuItem>
<MenuItem>
<span className="flex w-11 h-11 bg-gohan items-center justify-center">
<OtherFrame className="text-bulma text-moon-24" />
</span>
<MenuItem.MultiTitle
title="Providers"
text={<span> Your favourite games</span>}
/>
</MenuItem>
</>
);

export default Example;
Loading

0 comments on commit 82be643

Please sign in to comment.