mirror of
https://github.com/strapi/strapi.git
synced 2025-10-23 22:10:19 +00:00
Created plugin card component
This commit is contained in:
parent
8bec0273da
commit
521b627fd8
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* PluginCard
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import cn from 'classnames';
|
||||||
|
import styles from './styles.scss';
|
||||||
|
|
||||||
|
function PluginCard({ isAlreadyInstalled, plugin, showSupportUsButton }) {
|
||||||
|
return (
|
||||||
|
<div className={cn('col-md-4', styles.pluginCard)}>
|
||||||
|
<div className={styles.wrapper}>
|
||||||
|
<div className={styles.cardTitle}>
|
||||||
|
{plugin.name}
|
||||||
|
</div>
|
||||||
|
<div className={styles.cardDescription}></div>
|
||||||
|
<div className={styles.cardScreenshot}></div>
|
||||||
|
<div className={styles.cardPrice}></div>
|
||||||
|
<div className={styles.cardFooter}>{isAlreadyInstalled} {showSupportUsButton}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
PluginCard.defaultProps = {
|
||||||
|
isAlreadyInstalled: false,
|
||||||
|
plugin: {
|
||||||
|
description: '',
|
||||||
|
id: '',
|
||||||
|
icon: '',
|
||||||
|
name: '',
|
||||||
|
price: 0,
|
||||||
|
ratings: 5,
|
||||||
|
},
|
||||||
|
showSupportUsButton: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
PluginCard.propTypes = {
|
||||||
|
isAlreadyInstalled: PropTypes.bool,
|
||||||
|
plugin: PropTypes.object,
|
||||||
|
showSupportUsButton: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PluginCard;
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
.cardDescription {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardFooter {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardPrice {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardScreenshot {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardTitle {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.pluginCard {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
|
||||||
|
}
|
||||||
@ -5,28 +5,32 @@
|
|||||||
"id": "content-manager",
|
"id": "content-manager",
|
||||||
"icon": "plug",
|
"icon": "plug",
|
||||||
"name": "Content Manager",
|
"name": "Content Manager",
|
||||||
"price": 0
|
"price": 0,
|
||||||
|
"ratings": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "content-type-builder.plugin.description",
|
"description": "content-type-builder.plugin.description",
|
||||||
"id": "content-type-builder",
|
"id": "content-type-builder",
|
||||||
"icon": "brush",
|
"icon": "brush",
|
||||||
"name": "content type builder",
|
"name": "content type builder",
|
||||||
"price": 0
|
"price": 0,
|
||||||
|
"ratings": 4.4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "settings-manager.plugin.description",
|
"description": "settings-manager.plugin.description",
|
||||||
"id": "settings-manager",
|
"id": "settings-manager",
|
||||||
"icon": "wrench",
|
"icon": "wrench",
|
||||||
"name": "settings manager",
|
"name": "settings manager",
|
||||||
"price": 0
|
"price": 0,
|
||||||
|
"ratings": 2.5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "users-permissions.plugin.description",
|
"description": "users-permissions.plugin.description",
|
||||||
"id": "users-permissions",
|
"id": "users-permissions",
|
||||||
"icon": "users",
|
"icon": "users",
|
||||||
"name": "Auth & Permissions",
|
"name": "Auth & Permissions",
|
||||||
"price": 0
|
"price": 0,
|
||||||
|
"ratings": 3.6
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,9 +11,11 @@ import { Helmet } from 'react-helmet';
|
|||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { bindActionCreators, compose } from 'redux';
|
import { bindActionCreators, compose } from 'redux';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
|
import { get, isUndefined, map } from 'lodash';
|
||||||
|
|
||||||
// Design
|
// Design
|
||||||
import Input from 'components/Input';
|
import Input from 'components/Input';
|
||||||
|
import PluginCard from 'components/PluginCard';
|
||||||
import PluginHeader from 'components/PluginHeader';
|
import PluginHeader from 'components/PluginHeader';
|
||||||
|
|
||||||
import injectSaga from 'utils/injectSaga';
|
import injectSaga from 'utils/injectSaga';
|
||||||
@ -55,7 +57,7 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
|
|||||||
description={{ id: 'app.components.InstallPluginPage.description' }}
|
description={{ id: 'app.components.InstallPluginPage.description' }}
|
||||||
actions={[]}
|
actions={[]}
|
||||||
/>
|
/>
|
||||||
<div className="row">
|
<div className={cn('row', styles.inputContainer)}>
|
||||||
<Input
|
<Input
|
||||||
customBootstrapClass="col-md-12"
|
customBootstrapClass="col-md-12"
|
||||||
label="app.components.InstallPluginPage.InputSearch.label"
|
label="app.components.InstallPluginPage.InputSearch.label"
|
||||||
@ -67,6 +69,16 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
|
|||||||
value={this.props.search}
|
value={this.props.search}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="row">
|
||||||
|
{map(this.props.availablePlugins, (plugin) => (
|
||||||
|
<PluginCard
|
||||||
|
key={plugin.id}
|
||||||
|
plugin={plugin}
|
||||||
|
showSupportUsButton={plugin.id === 'support-us'}
|
||||||
|
isAlreadyInstalled={isUndefined(get(this.context.plugins.toJS(), plugin.id))}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -78,6 +90,7 @@ InstallPluginPage.contextTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
InstallPluginPage.propTypes = {
|
InstallPluginPage.propTypes = {
|
||||||
|
availablePlugins: PropTypes.array.isRequired,
|
||||||
didFetchPlugins: PropTypes.bool.isRequired,
|
didFetchPlugins: PropTypes.bool.isRequired,
|
||||||
getPlugins: PropTypes.func.isRequired,
|
getPlugins: PropTypes.func.isRequired,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
|
|||||||
@ -21,7 +21,7 @@ function installPluginPageReducer(state = initialState, action) {
|
|||||||
case GET_PLUGINS_SUCCEEDED:
|
case GET_PLUGINS_SUCCEEDED:
|
||||||
return state
|
return state
|
||||||
.set('didFetchPlugins', true)
|
.set('didFetchPlugins', true)
|
||||||
.set('plugins', List(action.availablePlugins));
|
.set('availablePlugins', List(action.availablePlugins));
|
||||||
case ON_CHANGE:
|
case ON_CHANGE:
|
||||||
return state.updateIn(action.keys, () => action.value);
|
return state.updateIn(action.keys, () => action.value);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -24,6 +24,7 @@ export function* pluginsGet() {
|
|||||||
icon: '',
|
icon: '',
|
||||||
name: 'buy a t-shirt',
|
name: 'buy a t-shirt',
|
||||||
price: 30,
|
price: 30,
|
||||||
|
ratings: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
yield put(getPluginsSucceeded(availablePlugins.concat([supportUs])));
|
yield put(getPluginsSucceeded(availablePlugins.concat([supportUs])));
|
||||||
|
|||||||
@ -2,5 +2,22 @@
|
|||||||
padding: 18px 30px !important;
|
padding: 18px 30px !important;
|
||||||
> div:first-child {
|
> div:first-child {
|
||||||
max-height: 33px;
|
max-height: 33px;
|
||||||
|
margin-bottom: 48px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputContainer {
|
||||||
|
padding-top: 7px;
|
||||||
|
background-color: #fff;
|
||||||
|
> div {
|
||||||
|
> div {
|
||||||
|
margin-bottom: 0!important;
|
||||||
|
}
|
||||||
|
> div:nth-child(3) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
> label {
|
||||||
|
display: none!important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getActions: () => {
|
getActions: () => {
|
||||||
|
console.log(strapi);
|
||||||
const generateActions = (data) => (
|
const generateActions = (data) => (
|
||||||
Object.keys(data).reduce((acc, key) => {
|
Object.keys(data).reduce((acc, key) => {
|
||||||
acc[key] = { enabled: false, policy: '' };
|
acc[key] = { enabled: false, policy: '' };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user