Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CodeField component #153

Merged
merged 10 commits into from
Sep 20, 2023
Merged

Add CodeField component #153

merged 10 commits into from
Sep 20, 2023

Conversation

ukorvl
Copy link
Member

@ukorvl ukorvl commented Sep 14, 2023

closes #152

This diff adds new CodeField component.
Component uses react-codemirror under the hood.
It can be used like so:

import {CodeField} from '@nilfoundation/ui-kit';
import { javascript } from '@codemirror/lang-javascript';
...
<CodeField
  extensions={[javascript({ jsx: true })]}
  code={
    `console.log('js is good')`
  }
  onCopy={({isCopied}) => {isCopied  && window.alert('Copied!')}}
/>

@ukorvl ukorvl self-assigned this Sep 14, 2023
@ukorvl ukorvl marked this pull request as draft September 14, 2023 14:46
@ukorvl ukorvl requested a review from KlonD90 September 18, 2023 15:57
@ukorvl ukorvl marked this pull request as ready for review September 18, 2023 15:57
@ukorvl ukorvl merged commit 66f2bb2 into master Sep 20, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CodeField component
2 participants