forked from liferay/clay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes liferay#1829 - Set up structure of component
- Loading branch information
1 parent
5201830
commit 4f6726f
Showing
10 changed files
with
162 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# clay-modal | ||
|
||
ClayModal component | ||
|
||
## Setup | ||
|
||
1. Install `yarn` | ||
|
||
2. Install local dependencies: | ||
|
||
``` | ||
yarn | ||
``` | ||
|
||
3. Build the code: | ||
|
||
``` | ||
yarn start | ||
``` | ||
|
||
4. Open the demo at `localhost:8080` on your browser. | ||
|
||
## Contribute | ||
|
||
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve. |
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,21 @@ | ||
/** | ||
* © 2019 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
import ClayModal from '../src/ClayModal'; | ||
|
||
import 'clay-css/lib/css/atlas.css'; | ||
|
||
const App: React.FunctionComponent = () => { | ||
return ( | ||
<div> | ||
<ClayModal /> | ||
</div> | ||
); | ||
}; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<body style="margin: 48px;"> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
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,31 @@ | ||
{ | ||
"name": "@clayui/modal", | ||
"version": "3.0.0", | ||
"description": "ClayModal component", | ||
"license": "BSD-3-Clause", | ||
"repository": "https://github.com/liferay/clay/tree/master/packages/clay-modal", | ||
"engines": { | ||
"node": ">=0.12.0", | ||
"npm": ">=3.0.0" | ||
}, | ||
"main": "lib/ClayModal.js", | ||
"esnext:main": "src/ClayModal.js", | ||
"jsnext:main": "src/ClayModal.js", | ||
"files": ["lib", "src"], | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib --extensions .ts,.tsx", | ||
"build:types": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json", | ||
"prepublishOnly": "npm run build && npm run build:types", | ||
"start": "webpack-dev-server --mode development", | ||
"test": "jest --config ../../jest.config.js" | ||
}, | ||
"keywords": ["clay", "react"], | ||
"dependencies": { | ||
"classnames": "^2.2.6" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.1", | ||
"react-dom": "^16.8.1" | ||
}, | ||
"browserslist": ["extends browserslist-config-clay"] | ||
} |
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,21 @@ | ||
/** | ||
* © 2019 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
interface Props extends React.HTMLAttributes<HTMLDivElement> {} | ||
|
||
const ClayModal: React.FunctionComponent<Props> = ({ | ||
className, | ||
...otherProps | ||
}) => { | ||
return ( | ||
<div {...otherProps} className={classNames(className)}>{'ClayModal'}</div> | ||
); | ||
}; | ||
|
||
export default ClayModal; |
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,19 @@ | ||
/** | ||
* © 2019 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import * as TestRenderer from 'react-test-renderer'; | ||
import ClayModal from '../ClayModal'; | ||
|
||
describe('ClayModal', () => { | ||
it('renders', () => { | ||
const testRenderer = TestRenderer.create( | ||
<ClayModal /> | ||
); | ||
|
||
expect(testRenderer.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/clay-modal/src/__tests__/__snapshots__/ClayModal.tsx.snap
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
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,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"declarationDir": "./lib" | ||
}, | ||
"extends": "../../tsconfig.declarations.json", | ||
"include": ["src"], | ||
"exclude": ["**/__tests__/**"] | ||
} |
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,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src"] | ||
} |
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 @@ | ||
/** | ||
* © 2019 Liferay, Inc. <https://liferay.com> | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
const path = require('path'); | ||
const HWP = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
entry: path.join(__dirname, 'demo/App.tsx'), | ||
module: { | ||
rules: [ | ||
{loader: 'awesome-typescript-loader', test: /\.tsx?$/}, | ||
{enforce: 'pre', loader: 'source-map-loader', test: /\.js$/}, | ||
{ | ||
test: /\.css$/, | ||
use: ['style-loader', 'css-loader'], | ||
}, | ||
], | ||
}, | ||
plugins: [new HWP({template: path.join(__dirname, './demo/index.html')})], | ||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js', '.json'], | ||
}, | ||
}; |