mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup example-extension
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
0219c62b8a
commit
21ab580144
@ -1,3 +1,7 @@
|
||||
# Lens Example Extension
|
||||
|
||||
*TODO*: add more info
|
||||
*TODO*: add more info
|
||||
|
||||
## Build
|
||||
|
||||
`npm run build`
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
import { Button, DynamicPageType, Icon, IconProps, LensExtension, React } from "@lens/extensions";
|
||||
import { CoffeeDoodle } from "react-open-doodles";
|
||||
import path from "path";
|
||||
import _ from "lodash"
|
||||
import stripAnsi from "strip-ansi"
|
||||
|
||||
export default class ExampleExtension extends LensExtension {
|
||||
onActivate() {
|
||||
_.has({a: 1}, "a")
|
||||
stripAnsi("asdasdasd")
|
||||
console.log('EXAMPLE EXTENSION: ACTIVATED', this.getMeta());
|
||||
this.registerPage({
|
||||
type: DynamicPageType.CLUSTER,
|
||||
@ -25,7 +23,7 @@ export default class ExampleExtension extends LensExtension {
|
||||
}
|
||||
|
||||
export function ExtensionIcon(props: IconProps) {
|
||||
return <Icon {...props} material="camera" tooltip={path.basename(__filename)}/>
|
||||
return <Icon {...props} material="pages" tooltip={path.basename(__filename)}/>
|
||||
}
|
||||
|
||||
export class ExtensionPage extends React.Component<{ extension: ExampleExtension }> {
|
||||
@ -37,10 +35,14 @@ export class ExtensionPage extends React.Component<{ extension: ExampleExtension
|
||||
|
||||
render() {
|
||||
const { TabLayout } = this.props.extension.runtime.components;
|
||||
const doodleStyle = {
|
||||
width: "200px"
|
||||
}
|
||||
return (
|
||||
<TabLayout className="ExampleExtension">
|
||||
<div className="flex column gaps align-flex-start">
|
||||
<p>{stripAnsi("Hello from extensions-api!!!!!!!")}</p>
|
||||
<div style={doodleStyle}><CoffeeDoodle accent="#3d90ce" /></div>
|
||||
<p>Hello from Example extension!</p>
|
||||
<p>File: <i>{__filename}</i></p>
|
||||
<Button accent label="Deactivate" onClick={this.deactivate}/>
|
||||
</div>
|
||||
|
||||
21
extensions/example-extension/package-lock.json
generated
21
extensions/example-extension/package-lock.json
generated
@ -4,23 +4,10 @@
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
||||
"requires": {
|
||||
"ansi-regex": "^5.0.0"
|
||||
}
|
||||
"react-open-doodles": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/react-open-doodles/-/react-open-doodles-1.0.5.tgz",
|
||||
"integrity": "sha512-TGYuRDL2XX2PG/9ZH2MXfYi/vbQLRnvqPxfzNRc4X3Nxmsiz93kIRmT5OWbItadvqEwZTD4IncwHMSLOTUvSZQ=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.0.3",
|
||||
|
||||
@ -8,10 +8,12 @@
|
||||
"styles": []
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.20",
|
||||
"react-open-doodles": "^1.0.5",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user