From fa42f954d83a1ac6b5788ca67642a0dd4cd48995 Mon Sep 17 00:00:00 2001
From: Frida Erdal
Date: Thu, 29 Oct 2020 10:26:15 +0100
Subject: [PATCH 01/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20JSX=20to=20TSX?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../stories/{Popover.stories.jsx => Popover.stories.tsx} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename apps/storybook-react/stories/{Popover.stories.jsx => Popover.stories.tsx} (100%)
diff --git a/apps/storybook-react/stories/Popover.stories.jsx b/apps/storybook-react/stories/Popover.stories.tsx
similarity index 100%
rename from apps/storybook-react/stories/Popover.stories.jsx
rename to apps/storybook-react/stories/Popover.stories.tsx
From f2dcf48646bf313c367d2354e10757315d82cefe Mon Sep 17 00:00:00 2001
From: Frida Erdal
Date: Thu, 29 Oct 2020 14:51:29 +0100
Subject: [PATCH 02/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Popover=20default=20?=
=?UTF-8?q?story=20with=20controls?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../stories/Popover.stories.tsx | 460 +++++++++---------
libraries/core-react/src/Popover/Popover.tsx | 87 ++--
libraries/core-react/src/Popover/index.ts | 3 +-
libraries/core-react/src/index.ts | 2 +-
4 files changed, 264 insertions(+), 288 deletions(-)
diff --git a/apps/storybook-react/stories/Popover.stories.tsx b/apps/storybook-react/stories/Popover.stories.tsx
index 7462b28f4f..5ebc88ffad 100644
--- a/apps/storybook-react/stories/Popover.stories.tsx
+++ b/apps/storybook-react/stories/Popover.stories.tsx
@@ -1,18 +1,14 @@
import React from 'react'
-import { withKnobs, select, text } from '@storybook/addon-knobs'
import styled from 'styled-components'
import {
Typography,
Button,
- Avatar,
- Chip,
- TextField,
- Search,
- Icon,
Popover,
+ PopoverProps,
Card,
} from '@equinor/eds-core-react'
-import catImg from '../images/cat.jpg'
+import { action } from '@storybook/addon-actions'
+import { Meta, Story } from '@storybook/react'
const { PopoverAnchor, PopoverTitle, PopoverContent } = Popover
const { CardActions } = Card
@@ -36,10 +32,61 @@ const TextWrapper = styled.div`
export default {
title: 'Components/Popover',
component: Popover,
- decorators: [withKnobs],
+ argTypes: {
+ placement: {
+ control: {
+ type: 'select',
+ options: [
+ 'topLeft',
+ 'top',
+ 'topRight',
+ 'rightTop',
+ 'right',
+ 'rightBottom',
+ 'bottomLeft',
+ 'bottom',
+ 'bottomRight',
+ 'leftTop',
+ 'left',
+ 'leftBottom',
+ ],
+ },
+ },
+ },
+} as Meta
+
+const handleClick = (e) => {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ action('handleClick')(e.target.textContent)
}
-export function Placement() {
+export const Default: Story = (args) => {
+ const [active, setActive] = React.useState(false)
+ const handleToggle = () => {
+ setActive(!active)
+ }
+ return (
+
+
+
+
+
+ Title
+
+ Content
+
+
+
+
+
+
+
+ )
+}
+
+export const Placements: Story = () => {
const [active, setActive] = React.useState(null)
const handleClick = (event) => {
@@ -64,7 +111,7 @@ export function Placement() {
)
return (
-
+ <>
Placement
@@ -73,161 +120,171 @@ export function Placement() {
inside the PopoverAnchor tag
-
- Top
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ Top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- Bottom
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Bottom
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- Left
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Right
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Left
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Right
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
)
}
-export function ActivationTypes() {
+export const ActivationTypes: Story = () => {
const [active, setActive] = React.useState(null)
const handleClick = (event) => {
@@ -298,86 +355,3 @@ export function ActivationTypes() {
-
- With knobs
-
-
-
- {title}
- {ANCHOR_CHOICES[anchor]}
-
- {content}
-
- {ACTIONS_CHOICES[action]}
-
-
-