Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bgoodman/react-console-component

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bgoodman/react-console-component - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

13

dist/types.d.ts
import React from "react";
import { DefaultTheme } from "styled-components";
export interface Theme {
font: {
size: string;
family: string;
};
colors: {
background: string;
text: string;
};
}
interface ConsoleProps {

@@ -9,3 +18,3 @@ prompt?: string;

height?: string;
theme?: DefaultTheme;
theme?: Theme;
}

@@ -12,0 +21,0 @@ export const Console: ({ prompt, autoScroll, height, theme, ...props }: ConsoleProps) => React.JSX.Element;

5

package.json
{
"name": "@bgoodman/react-console-component",
"version": "1.0.2",
"version": "1.0.3",
"publishConfig": {

@@ -29,4 +29,3 @@ "access": "public"

"scripts": {
"build": "npx parcel build src/index.ts",
"start": "npm run build && ./demo/start"
"build": "npx parcel build src/index.ts"
},

@@ -33,0 +32,0 @@ "peerDependencies": {

@@ -5,2 +5,4 @@ # React Console Component

> Try the demo [here](https://ben_goodman.gitlab.io/ui-components/react-console-component/).
![An example using a Bash interpreter](https://gitlab.com/ben_goodman/ui-components/react-console-component/-/raw/main/docs/react-console.gif)

@@ -27,7 +29,11 @@

const evalCmd = (cmd: string): Promise<string> => {
// do something with the input command.
const result = eval(cmd).toString()
// return the result as a promise
return Promise.resolve(result)
const evalCmd = (cmd) => {
try {
// do something with the input command.
const result = eval(cmd).toString()
// return the result as a promise
return Promise.resolve(result)
} catch (err) {
return Promise.resolve(err.toString())
}
}

@@ -59,10 +65,12 @@

| autoScroll | `boolean` | `true` | If true, the console will automatically scroll to the bottom when new content is added. |
| theme | `DefaultTheme` | See 'Themes' section. | A custom theme to use for the console. If not provided, the default light theme will be used. |
| theme | `Theme` | See 'Themes' section. | A custom theme to use for the console. If not provided, the default light theme will be used. |
## Themes
The console component uses the `styled-components` library to style the console. You can provide your own theme by passing a `DefaultTheme` object to the `theme` prop. For example, the default theme is defined as:
The console component uses the `styled-components` library to style the console. You can provide your own theme by passing a `Theme` object to the `theme` prop. For example, the default theme is defined as:
```ts
const lightTheme: DefaultTheme = {
import { type Theme } from '@bgoodman/react-console-component'
const lightTheme: Theme = {
font: {

@@ -82,3 +90,3 @@ size: '16px',

```ts
const darkTheme: DefaultTheme = {
const darkTheme: Theme = {
font: {

@@ -85,0 +93,0 @@ size: '16px',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc