diff --git a/packages/netlify-cms-backend-git-gateway/package.json b/packages/netlify-cms-backend-git-gateway/package.json new file mode 100644 index 00000000..1628cd3a --- /dev/null +++ b/packages/netlify-cms-backend-git-gateway/package.json @@ -0,0 +1,39 @@ +{ + "name": "netlify-cms-backend-git-gateway", + "description": "Git Gateway backend for Netlify CMS", + "version": "2.0.0-alpha.0", + "license": "MIT", + "main": "dist/netlify-cms-backend-git-gateway.js", + "keywords": [ + "netlify", + "netlify-cms", + "backend", + "git-gateway", + "gateway" + ], + "sideEffects": false, + "scripts": { + "watch": "webpack -w", + "build": "webpack" + }, + "dependencies": { + "gotrue-js": "^0.9.22", + "jwt-decode": "^2.2.0" + }, + "devDependencies": { + "webpack": "^4.16.1", + "webpack-cli": "^3.1.0" + }, + "peerDependencies": { + "immutable": "^3.7.6", + "lodash": "^4.17.10", + "netlify-cms-backend-github": "2.0.0-alpha.0", + "netlify-cms-backend-gitlab": "2.0.0-alpha.0", + "netlify-cms-lib-auth": "2.0.0-alpha.0", + "netlify-cms-lib-util": "2.0.0-alpha.0", + "netlify-cms-ui-default": "2.0.0-alpha.0", + "prop-types": "^15.6.2", + "react": "^16.4.1", + "react-emotion": "^9.2.6" + } +} diff --git a/packages/netlify-cms-core/src/backends/git-gateway/AuthenticationPage.js b/packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js similarity index 59% rename from packages/netlify-cms-core/src/backends/git-gateway/AuthenticationPage.js rename to packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js index 1629d926..458bd8b3 100644 --- a/packages/netlify-cms-core/src/backends/git-gateway/AuthenticationPage.js +++ b/packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js @@ -1,10 +1,59 @@ import PropTypes from 'prop-types'; -import React from "react"; +import React from 'react'; +import styled from 'react-emotion'; import { partial } from 'lodash'; -import { Icon } from 'netlify-cms-ui-default'; +import { + Icon, + AuthenticationPage, + buttons, + shadows, + colors, + colorsRaw, + lengths +} from 'netlify-cms-ui-default'; + +const LoginButton = styled.button` + ${buttons.button}; + ${shadows.dropDeep}; + ${buttons.default}; + ${buttons.gray}; + + padding: 0 30px; + display: block; + margin-top: 20px; + margin-left: auto; +` + +const AuthForm = styled.form` + width: 350px; + margin-top: -80px; +` + +const AuthInput = styled.input` + background-color: ${colorsRaw.white}; + border-radius: ${lengths.borderRadius}; + + font-size: 14px; + padding: 10px 10px; + margin-bottom: 15px; + margin-top: 6px; + width: 100%; + position: relative; + z-index: 1; + + &:focus { + outline: none; + box-shadow: inset 0 0 0 2px ${colors.active}; + } +` + +const ErrorMessage = styled.p` + color: ${colors.errorText}; +` let component = null; +console.log(window.netlifyIdentity); if (window.netlifyIdentity) { window.netlifyIdentity.on('login', (user) => { component && component.handleIdentityLogin(user); @@ -14,7 +63,7 @@ if (window.netlifyIdentity) { }); } -export default class AuthenticationPage extends React.Component { +export default class GitGatewayAuthenticationPage extends React.Component { constructor(props) { super(props); component = this; @@ -91,45 +140,40 @@ export default class AuthenticationPage extends React.Component { const { error, inProgress } = this.props; if (window.netlifyIdentity) { - return - - - Login with Netlify Identity - - + return ( + 'Login with Netlify Identity'} + /> + ); } + console.log('returning'); + return ( - - - - {!error && - {error} - } - {!errors.server && - {errors.server} - } - { errors.email || null } - ( + + {!error ? null : {error}} + {!errors.server ? null : {errors.server}} + {errors.email || null} + - { errors.password || null } - {errors.password || null} + - - {inProgress ? "Logging in..." : "Login"} - - - + {inProgress ? 'Logging in...' : 'Login'} + + )}/> ); } } diff --git a/packages/netlify-cms-core/src/backends/git-gateway/GitHubAPI.js b/packages/netlify-cms-backend-git-gateway/src/GitHubAPI.js similarity index 100% rename from packages/netlify-cms-core/src/backends/git-gateway/GitHubAPI.js rename to packages/netlify-cms-backend-git-gateway/src/GitHubAPI.js diff --git a/packages/netlify-cms-core/src/backends/git-gateway/GitLabAPI.js b/packages/netlify-cms-backend-git-gateway/src/GitLabAPI.js similarity index 100% rename from packages/netlify-cms-core/src/backends/git-gateway/GitLabAPI.js rename to packages/netlify-cms-backend-git-gateway/src/GitLabAPI.js diff --git a/packages/netlify-cms-core/src/backends/git-gateway/implementation.js b/packages/netlify-cms-backend-git-gateway/src/implementation.js similarity index 99% rename from packages/netlify-cms-core/src/backends/git-gateway/implementation.js rename to packages/netlify-cms-backend-git-gateway/src/implementation.js index 3a10e2b3..d759fdc6 100644 --- a/packages/netlify-cms-core/src/backends/git-gateway/implementation.js +++ b/packages/netlify-cms-backend-git-gateway/src/implementation.js @@ -1,6 +1,6 @@ import GoTrue from "gotrue-js"; import jwtDecode from 'jwt-decode'; -import {List} from 'immutable'; +import { List } from 'immutable'; import { get, pick, intersection } from "lodash"; import { unsentRequest } from "netlify-cms-lib-util"; import { GitHubBackend } from "netlify-cms-backend-github"; diff --git a/packages/netlify-cms-backend-git-gateway/src/index.js b/packages/netlify-cms-backend-git-gateway/src/index.js new file mode 100644 index 00000000..b7ace893 --- /dev/null +++ b/packages/netlify-cms-backend-git-gateway/src/index.js @@ -0,0 +1,3 @@ +export GitGatewayBackend from './implementation'; +export AuthenticationPage from './AuthenticationPage'; + diff --git a/packages/netlify-cms-backend-git-gateway/webpack.config.js b/packages/netlify-cms-backend-git-gateway/webpack.config.js new file mode 100644 index 00000000..52d79f92 --- /dev/null +++ b/packages/netlify-cms-backend-git-gateway/webpack.config.js @@ -0,0 +1 @@ +module.exports = require('../../webpack.config.js'); diff --git a/packages/netlify-cms-core/example/config.yml b/packages/netlify-cms-core/example/config.yml index c11299a4..28b01853 100644 --- a/packages/netlify-cms-core/example/config.yml +++ b/packages/netlify-cms-core/example/config.yml @@ -1,11 +1,9 @@ backend: - name: gitlab - repo: erquhart/blank + name: test-repo display_url: https://example.com media_folder: "assets/uploads" - collections: # A list of collections the CMS should be able to edit - name: "posts" # Used in routes, ie.: /admin/collections/:slug/edit label: "Posts" # Used in the UI diff --git a/packages/netlify-cms-core/example/index.html b/packages/netlify-cms-core/example/index.html index aad74513..8e50e2d2 100644 --- a/packages/netlify-cms-core/example/index.html +++ b/packages/netlify-cms-core/example/index.html @@ -4,7 +4,7 @@ Netlify CMS Development Test - +
- {error} -
- {errors.server} -