-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
215 changed files
with
4,395 additions
and
279 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ stats.json | |
package-lock.json | ||
yarn-error.log | ||
|
||
|
||
# Cruft | ||
.DS_Store | ||
npm-debug.log | ||
|
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,11 @@ | ||
module.exports = { | ||
stories: [ | ||
'../*.stories.mdx', | ||
'../lib/src/**/*.stories.mdx', | ||
'../lib/src/**/*.stories.@(js|jsx|ts|tsx)', | ||
], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials'], | ||
core: { | ||
builder: 'webpack5', | ||
}, | ||
}; |
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,9 @@ | ||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}; |
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,7 @@ | ||
import { Meta } from '@storybook/addon-docs'; | ||
|
||
<Meta title="Introduction" /> | ||
|
||
# Welcome to the Helper plugin documentation | ||
|
||
Here you will find the documentation related to the complex components that are used in the Strapi admin panel. |
25 changes: 25 additions & 0 deletions
25
...plugin/lib/src/components/CheckPagePermissions/CheckPagePermissions.stories.mdx
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,25 @@ | ||
import { Meta } from '@storybook/addon-docs'; | ||
|
||
<Meta title="components/CheckPagePermissions" /> | ||
|
||
# CheckPagePermissions | ||
|
||
This component is used in order to apply RBAC to a view. If the user does not have the permissions to access the view he will be redirect to the homepage: | ||
|
||
## Usage | ||
|
||
``` | ||
import { CheckPagePermissions } from '@strapi/helper-plugin'; | ||
const permissions = [{ action: 'plugins::my-plugin.access', subject: null }]; | ||
const HomePage = () => { | ||
return ( | ||
<CheckPagePermissions permissions={permissions}> | ||
<main> | ||
<h1>This is the homepage</h1> | ||
</main> | ||
</CheckPagePermissions> | ||
); | ||
}; | ||
``` |
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
26 changes: 26 additions & 0 deletions
26
.../helper-plugin/lib/src/components/CheckPermissions/CheckPermissions.stories.mdx
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,26 @@ | ||
import { Meta } from '@storybook/addon-docs'; | ||
|
||
<Meta title="components/CheckPermissions" /> | ||
|
||
# CheckPermissions | ||
|
||
This component is used in order to apply RBAC to a component. If the user does not have the permissions to view a component it will be hidden. | ||
|
||
## Usage | ||
|
||
``` | ||
import { CheckPermissions } from '@strapi/helper-plugin'; | ||
const permissions = [{ action: 'plugins::my-plugin.read', subject: null }]; | ||
const HomePage = () => { | ||
return ( | ||
<main> | ||
<h1>This is the homepage</h1> | ||
<CheckPermissions permissions={permissions}> | ||
You can all see this if you have the right to. | ||
</CheckPermissions> | ||
</main> | ||
); | ||
}; | ||
``` |
54 changes: 54 additions & 0 deletions
54
...s/core/helper-plugin/lib/src/components/InjectionZone/InjectionZone.stories.mdx
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,54 @@ | ||
import { Meta } from '@storybook/addon-docs'; | ||
|
||
<Meta title="components/InjectionZone" /> | ||
|
||
# InjectionZone | ||
|
||
This component is used in order to define an injection zone that other plugins can use to add components in a dedicated area. | ||
|
||
## Usage | ||
|
||
``` | ||
// Use the injection zone in a view | ||
import { InjectionZone } from '@strapi/helper-plugin'; | ||
const HomePage = () => { | ||
return ( | ||
<main> | ||
<h1>This is the homepage</h1> | ||
</main> | ||
<InjectionZone area="my-plugin.homePage.right" /> | ||
); | ||
}; | ||
// Define this injection zone | ||
// path: 'my-plugin/admin/src/index.js | ||
export default { | ||
register() { | ||
app.registerPlugin({ | ||
// ... | ||
injectionZones: { | ||
homepage: { | ||
right: [] | ||
} | ||
} | ||
}); | ||
}, | ||
} | ||
// Inject from a plugin | ||
// path: 'my-other-plugin/admin/src/index.js' | ||
export default { | ||
register() { | ||
// ... | ||
}, | ||
bootstrap(app) { | ||
app.getPlugin('my-plugin').injectComponent('homePage', 'right', { | ||
name: 'my-other-plugin-component', | ||
Component: () => 'This component is injected', | ||
}); | ||
} | ||
}; | ||
``` |
2 changes: 1 addition & 1 deletion
2
...gin/lib/src/content-manager/utils/tests/contentManagementUtilRemoveFieldsFromData.test.js
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
2 changes: 1 addition & 1 deletion
2
packages/core/helper-plugin/lib/src/content-manager/utils/tests/formatComponentData.test.js
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.