Skip to content

Commit

Permalink
[DOC] update syntax for fields.js in readme code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dmh committed Jun 29, 2023
1 parent ed147e8 commit 5dfaf16
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ Each field or group with some exceptions consists of:
- Repeater options

```js
import { initModule } from '@resultify/hubspot-fields-js/lib/init.js'
import { fi } from '@resultify/hubspot-fields-js/fields.js'
import { group, styleGroup } from '@resultify/hubspot-fields-js/lib/group.js'
import {
group,
styleGroup,
init,
writeJson,
moduleFields as fi
} from '@resultify/hubspot-fields-js'

initModule( //initialize module
writeJson(init( //initialize module and write to JSON (fields.json)
fi.text( // add text field
'Text', // label
'text', // name
Expand All @@ -98,15 +102,19 @@ initModule( //initialize module
repeater_options: {} // repeater options
}
)
)
))
```

```js
import { initModule } from '@resultify/hubspot-fields-js/lib/init.js'
import { fi } from '@resultify/hubspot-fields-js/fields.js'
import { group, styleGroup } from '@resultify/hubspot-fields-js/lib/group.js'
import {
group,
styleGroup,
init,
writeJson,
moduleFields as fi
} from '@resultify/hubspot-fields-js'

initModule( //initialize module
writeJson(init( //initialize module and write to JSON (fields.json)
group( // add group
'Group', // group label
'group', // group name
Expand All @@ -123,17 +131,21 @@ initModule( //initialize module
fi.text( 'Text2', 'text2')
)
)
)
))
```

## Example

```js
import { initModule } from '@resultify/hubspot-fields-js/lib/init.js'
import { fi } from '@resultify/hubspot-fields-js/fields.js'
import { group, styleGroup } from '@resultify/hubspot-fields-js/lib/group.js'
import {
group,
styleGroup,
init,
writeJson,
moduleFields as fi
} from '@resultify/hubspot-fields-js'

initModule(
writeJson(init(
fi.boolean('Boolean', 'boolean_field', {
display: 'toggle',
default: true,
Expand Down Expand Up @@ -225,7 +237,7 @@ initModule(
type: 'BLOG'
}
})
)
))
```
Check more examples in `partials` folder.

Expand Down

0 comments on commit 5dfaf16

Please sign in to comment.