Skip to content

Commit

Permalink
refactor!: Rename Editor to PrismInput
Browse files Browse the repository at this point in the history
  • Loading branch information
zane committed Oct 4, 2022
1 parent 9814233 commit 7f86dfb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/Editor.jsx → src/PrismInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Prism.languages.iql = {
operator: new RegExp(`[+\\-*\\/><=/>]|${operators.join('|')}\\b`, 'i'),
};

const Editor = React.forwardRef(
const PrismInput = React.forwardRef(
({ code, disabled, setCode, ...props }, forwardedRef) => {
const ref = forwardedRef ?? useRef();
const onChange = useCallback(
Expand Down Expand Up @@ -119,8 +119,8 @@ const Editor = React.forwardRef(
onKeyDown={onKeyDown}
ref={ref}
style={{
padding: '10px',
display: 'block',
padding: '10px',
whiteSpace: 'pre-wrap',
...style,
}}
Expand All @@ -146,18 +146,18 @@ const Editor = React.forwardRef(
}
);

Editor.displayName = 'Editor';
PrismInput.displayName = 'PrismInput';

export default Editor;
export default PrismInput;

Editor.propTypes = {
PrismInput.propTypes = {
code: PropTypes.string,
disabled: PropTypes.bool,
onKeyDown: PropTypes.func,
setCode: PropTypes.func.isRequired,
};

Editor.defaultProps = {
PrismInput.defaultProps = {
code: '',
disabled: false,
onKeyDown: undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/Query.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { ArrowBackUp, Database } from 'tabler-icons-react';
import { Button, Paper, Space } from '@mantine/core';
import Editor from './Editor';
import PrismInput from './PrismInput';
import DataTable from './DataTable';

const usePrevious = (value) => {
Expand Down Expand Up @@ -45,7 +45,7 @@ export default function Query({ execute, initialQuery }) {

return (
<Paper p="sm" radius="sm" shadow="md" withBorder>
<Editor
<PrismInput
code={queryValue}
disabled={Boolean(queryResult)}
onKeyDown={onKeyDown}
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as DataTable } from './DataTable';
export { default as Editor } from './Editor';
export { default as HighlightInput } from './HighlightInput';
export { default as PrismInput } from './PrismInput';
export { default as Query } from './Query';
12 changes: 6 additions & 6 deletions stories/Editor.stories.jsx → stories/PrismInput.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { useState } from 'react';
import Editor from '../src/Editor';
import PrismInput from '../src/PrismInput';

export default {
title: 'Editor',
component: Editor,
title: 'PrismInput',
component: PrismInput,
argTypes: {},
};

function Template({ code, disabled, onKeyDown }) {
const [codeValue, setCode] = useState(code);
return (
<Editor
<PrismInput
code={codeValue}
disabled={disabled}
onKeyDown={onKeyDown}
Expand All @@ -19,8 +19,8 @@ function Template({ code, disabled, onKeyDown }) {
);
}

Template.propTypes = Editor.propTypes;
Template.defaultProps = Editor.defaultProps;
Template.propTypes = PrismInput.propTypes;
Template.defaultProps = PrismInput.defaultProps;

export const Empty = Template.bind({});
Empty.args = {
Expand Down

0 comments on commit 7f86dfb

Please sign in to comment.