Skip to content

Commit

Permalink
Merge pull request #88 from tjinauyeung/feat/add-textarea-component
Browse files Browse the repository at this point in the history
feat(textarea): add component and tests
  • Loading branch information
tiaanduplessis authored Feb 7, 2021
2 parents 7d8e46f + 12172c2 commit f88789a
Show file tree
Hide file tree
Showing 9 changed files with 584 additions and 130 deletions.
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ module.exports = {
env: {
test: {
presets: [['@babel/preset-env', {targets: {node: 'current'}}]],
plugins: [
// required for svelte-jsx and svelte-fragment-component
[
'@babel/plugin-transform-react-jsx',
{runtime: 'automatic', importSource: 'svelte-jsx'},
],
],
},
},
};
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const jestCommon = require('./test/config/jest.common');
const lintProject = require('./test/config/jest.lint');
const unitTestProject = require('./test/config/jest.unit');
const testProject = require('./test/config/jest.test');

module.exports = {
...jestCommon,

projects: [unitTestProject, lintProject],
projects: [testProject, lintProject],
};
12 changes: 12 additions & 0 deletions lib/components/Textarea.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
import {getContext} from 'svelte';
import {key} from './key';
export let name;
const {form, handleChange} = getContext(key);
</script>

<textarea {name} on:change={handleChange} on:blur={handleChange} {...$$props}>
{$form[name]}
</textarea>
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {key} from './components/key';
export {createForm} from './create-form';

export {default as Form} from './components/Form.svelte';
export {default as Textarea} from './components/Textarea.svelte';
export {default as Field} from './components/Field.svelte';
export {default as Select} from './components/Select.svelte';
export {default as ErrorMessage} from './components/ErrorMessage.svelte';
Expand Down
Loading

0 comments on commit f88789a

Please sign in to comment.