From b50a7a48086205d65815c53f8bb622724a034cba Mon Sep 17 00:00:00 2001 From: Nitin Ramnani Date: Fri, 3 May 2024 18:17:04 +0530 Subject: [PATCH 1/3] Added stories for multiple components Signed-off-by: Nitin Ramnani --- .../src/layout/Content/Content.stories.tsx | 50 +++++++++++++++++++ .../HeaderActionMenu.stories.tsx | 45 +++++++++++++++++ .../HeaderLabel/HeaderLabel.stories.tsx | 35 +++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 packages/core-components/src/layout/Content/Content.stories.tsx create mode 100644 packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx create mode 100644 packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx diff --git a/packages/core-components/src/layout/Content/Content.stories.tsx b/packages/core-components/src/layout/Content/Content.stories.tsx new file mode 100644 index 0000000000..de1b17de0f --- /dev/null +++ b/packages/core-components/src/layout/Content/Content.stories.tsx @@ -0,0 +1,50 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React, { ReactNode } from 'react'; +import { Content } from './Content'; + +export default { + title: 'Layout/Content', + component: Content, +}; + +type Props = { + stretch?: boolean; + noPadding?: boolean; + className?: string; +}; + +export const Default = (args: Props) => ( + +
This is child of content component
+
+); + +Default.args = { + stretch: false, + noPadding: false, +}; + +export const WithNoPadding = (args: Props) => ( + +
This is child of content component
+
+); + +WithNoPadding.args = { + stretch: true, + noPadding: true, +}; diff --git a/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx b/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx new file mode 100644 index 0000000000..0d185aeb11 --- /dev/null +++ b/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx @@ -0,0 +1,45 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react'; +import { HeaderActionMenu, HeaderActionMenuProps } from './HeaderActionMenu'; + +export default { + title: 'Layout/HeaderActionMenu', + component: HeaderActionMenu, +}; + +export const Default = (args: HeaderActionMenuProps) => ( + +); +Default.args = { + actionItems: [ + { + label: 'Item 1', + secondaryLabel: 'Item 1 secondary label', + disabled: false, + }, + { + label: 'Item 2', + secondaryLabel: 'Item 2 secondary label', + disabled: true, + }, + { + label: 'Item 3', + secondaryLabel: 'Item 3 secondary label', + disabled: true, + }, + ], +}; diff --git a/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx b/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx new file mode 100644 index 0000000000..80baa83a4f --- /dev/null +++ b/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx @@ -0,0 +1,35 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react'; +import { HeaderLabel } from './HeaderLabel'; + +export default { + title: 'Layout/HeaderLabel', + component: HeaderLabel, +}; + +type HeaderLabelProps = { + label: string; + value?: string; + url?: string; +}; + +export const Default = (args: HeaderLabelProps) => ; +Default.args = { + label: 'This is label', + value: 'This is value', + url: 'https://backstage.io', +}; From c27808698f689fca403056be2007df23b6c9f7ca Mon Sep 17 00:00:00 2001 From: Nitin Ramnani Date: Fri, 3 May 2024 18:32:54 +0530 Subject: [PATCH 2/3] Added stories for multiple components Signed-off-by: Nitin Ramnani --- packages/core-components/src/layout/Content/Content.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core-components/src/layout/Content/Content.stories.tsx b/packages/core-components/src/layout/Content/Content.stories.tsx index de1b17de0f..f8bf055145 100644 --- a/packages/core-components/src/layout/Content/Content.stories.tsx +++ b/packages/core-components/src/layout/Content/Content.stories.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { ReactNode } from 'react'; +import React from 'react'; import { Content } from './Content'; export default { From 2f09d4b7cc04893649b69eb48a432e528cbe3f58 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 6 May 2024 11:47:18 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Signed-off-by: Patrik Oldsberg --- packages/core-components/src/layout/Content/Content.stories.tsx | 2 +- .../src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx | 2 +- .../src/layout/HeaderLabel/HeaderLabel.stories.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core-components/src/layout/Content/Content.stories.tsx b/packages/core-components/src/layout/Content/Content.stories.tsx index f8bf055145..fcf8858adc 100644 --- a/packages/core-components/src/layout/Content/Content.stories.tsx +++ b/packages/core-components/src/layout/Content/Content.stories.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Backstage Authors + * Copyright 2024 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx b/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx index 0d185aeb11..dc50456f7e 100644 --- a/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx +++ b/packages/core-components/src/layout/HeaderActionMenu/HeaderActionMenu.stories.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Backstage Authors + * Copyright 2024 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx b/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx index 80baa83a4f..58566a27d2 100644 --- a/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx +++ b/packages/core-components/src/layout/HeaderLabel/HeaderLabel.stories.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Backstage Authors + * Copyright 2024 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.