-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add further stories and minor refactoring (#132)
## Short description This PR includes some stories on the storybook collection and adds some minor refactoring ## List of changes proposed in this pull request - Adds some stories - Minor refactoring and file movement ## How to test run storybook
- Loading branch information
1 parent
8423cf7
commit 2c20825
Showing
50 changed files
with
1,018 additions
and
77 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { addons } from "@storybook/manager-api"; | ||
import { sbTheme } from "./theme"; | ||
|
||
addons.setConfig({ | ||
theme: sbTheme | ||
}); |
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { create } from "@storybook/theming"; | ||
|
||
export const sbTheme = create({ | ||
base: "light", | ||
brandTitle: "IO App Design System", | ||
brandUrl: "https://github.com/pagopa/io-app-design-system", | ||
brandImage: | ||
"https://raw.githubusercontent.com/pagopa/io-app/master/img/app-logo.svg", | ||
brandTarget: "_self" | ||
}); |
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
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
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-11-09T14:14:48.721Z |
File renamed without changes.
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
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,120 @@ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"prettier", | ||
"plugin:storybook/recommended" | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "tsconfig.json", | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
plugins: [ | ||
"@typescript-eslint", | ||
"react", | ||
"react-native", | ||
"react-hooks", | ||
"import", | ||
"functional" | ||
], | ||
rules: { | ||
"no-case-declarations": "off", | ||
"no-inner-declarations": "off", | ||
"prefer-const": "error", | ||
curly: "error", | ||
"spaced-comment": ["error", "always", { block: { balanced: true } }], | ||
radix: "error", | ||
"one-var": ["error", "never"], | ||
"object-shorthand": "error", | ||
"no-var": "error", | ||
"no-param-reassign": "error", | ||
"no-underscore-dangle": "error", | ||
"no-undef-init": "error", | ||
"no-throw-literal": "error", | ||
"no-new-wrappers": "error", | ||
"no-eval": "error", | ||
"no-console": "error", | ||
"no-caller": "error", | ||
"no-bitwise": "error", | ||
"no-duplicate-imports": "error", | ||
eqeqeq: ["error", "smart"], | ||
"max-classes-per-file": ["error", 1], | ||
"guard-for-in": "error", | ||
complexity: "error", | ||
"arrow-body-style": "error", | ||
"import/order": "error", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
// Enable if we want to enforce the return type for all the functions | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
// TODO: added for compatibility. Removing this line we have to remove all the any usage in the code | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/array-type": [ | ||
"error", | ||
{ | ||
default: "generic" | ||
} | ||
], | ||
"@typescript-eslint/await-thenable": "error", | ||
"@typescript-eslint/consistent-type-assertions": "error", | ||
"@typescript-eslint/dot-notation": "error", | ||
"@typescript-eslint/member-delimiter-style": [ | ||
"error", | ||
{ | ||
multiline: { | ||
delimiter: "semi", | ||
requireLast: true | ||
}, | ||
singleline: { | ||
delimiter: "semi", | ||
requireLast: false | ||
} | ||
} | ||
], | ||
"@typescript-eslint/no-floating-promises": "error", | ||
"no-unused-expressions": "off", | ||
"@typescript-eslint/no-unused-expressions": ["error"], | ||
"@typescript-eslint/prefer-function-type": "error", | ||
"@typescript-eslint/restrict-plus-operands": "error", | ||
semi: "off", | ||
"@typescript-eslint/semi": ["error"], | ||
"@typescript-eslint/unified-signatures": "error", | ||
"react/prop-types": "off", | ||
"react/display-name": "off", | ||
"react/jsx-key": "error", | ||
"react/jsx-no-bind": ["error", { allowArrowFunctions: true }], | ||
"functional/no-let": "error", | ||
"functional/immutable-data": "error", | ||
"react-native/no-unused-styles": "error", | ||
"react-native/split-platform-components": "off", | ||
"react-native/no-inline-styles": "off", | ||
"react-native/no-color-literals": "error", | ||
"react-native/no-raw-text": | ||
"off" /* Error when you launch the lint command */, | ||
"react-native/no-single-element-style-arrays": "warn" | ||
}, | ||
env: { | ||
"react-native/react-native": true | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["**/*.test.*"], | ||
rules: { | ||
"@typescript-eslint/no-non-null-assertion": "off" | ||
} | ||
} | ||
], | ||
settings: { | ||
react: { | ||
version: "detect" | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from "react"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { AccordionItem, Caption } from "../../src/components"; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
const meta = { | ||
title: "IO-App Design System/Atoms/Accordion/Accordion", | ||
component: AccordionItem, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: "padded" | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs | ||
tags: ["autodocs"] | ||
} satisfies Meta<typeof AccordionItem>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args | ||
export const BaseAccordion: Story = { | ||
args: { | ||
title: "Accordion Title", | ||
id: 1, | ||
body: <Caption>{"Accordion body"}</Caption> | ||
} | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { action } from "@storybook/addon-actions"; | ||
|
||
import { ButtonExtendedOutline } from "../../src/components"; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
const meta = { | ||
title: "IO-App Design System/Components/Buttons/ButtonExtendedOutline", | ||
component: ButtonExtendedOutline, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: "centered" | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs | ||
tags: ["autodocs"] | ||
} satisfies Meta<typeof ButtonExtendedOutline>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args | ||
export const Primary: Story = { | ||
args: { | ||
label: "Primary button", | ||
onPress: e => { | ||
action("clicked")(e); | ||
} | ||
} | ||
}; |
8 changes: 4 additions & 4 deletions
8
src/stories/ButtonDS.stories.ts → stories/buttons/ButtonLink.stories.ts
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
Oops, something went wrong.