Skip to content

Commit

Permalink
Change property type from 'Object' to 'String'
Browse files Browse the repository at this point in the history
The app attribute for html element only accepts string,
so its better  to accept json in string format
and then parse it with help of JSON.parse();

Update README
  • Loading branch information
yashoswalyo committed Aug 22, 2023
1 parent e51a581 commit 250984b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/opc-feedback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import '@one-platform/opc-feedback/dist/opc-feedback';
|---------|------------------------------------------------------------------|
| ```spa``` | ```String``` value is expected ```/feedback``` is the default fallback url for feedback spa |
| ```docs``` | ```String``` value is expected ```/get-started``` is the default fallback url for docs |
| ```app``` | ```Object``` value is expected ```{ name: 'one platform', url: '/' }``` is the default fallback url for docs |
| ```app``` | ```String``` value is expected in json format ```'{ "name": "one platform", "url": "/" }'``` is the default fallback url for docs |
| ```theme``` | Refer [themes](https://github.com/1-Platform/op-components/tree/master/packages/opc-feedback/README.md#themes) section. |


Expand Down
11 changes: 6 additions & 5 deletions packages/opc-feedback/src/opc-feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class OpcFeedback extends LitElement {
@property({ type: String, attribute: 'docs' }) docs = '/get-started';
@property({ reflect: true }) theme = 'red';
@property({ type: Object }) template = defaultTemplate;
@property({ type: Object }) app = defaultApplication;
@property({ type: String }) app = `{"name": "${defaultApplication.name}" ,"url":"${defaultApplication.url}"}`;
@state()
_openConfirmationModal = false;
@state()
Expand Down Expand Up @@ -189,6 +189,7 @@ export class OpcFeedback extends LitElement {
}

render() {
const app = JSON.parse(this.app);
this._updateTemplate();
return html`
<!-- Bug Panel -->
Expand Down Expand Up @@ -279,8 +280,8 @@ export class OpcFeedback extends LitElement {
</form>
<p class="pf-u-font-size-xs">
Bug reporting for
<a href="${this.app.url}" target="_blank" rel="noopener noreferrer">
${this.app.name}
<a href="${app.url}" target="_blank" rel="noopener noreferrer">
${app.name}
</a>
</p>
</dialog>
Expand Down Expand Up @@ -385,8 +386,8 @@ export class OpcFeedback extends LitElement {
</form>
<p class="pf-u-font-size-xs">
Feedback for
<a href="${this.app.url}" target="_blank" rel="noopener noreferrer">
${this.app.name}
<a href="${app.url}" target="_blank" rel="noopener noreferrer">
${app.name}
</a>
</p>
</dialog>
Expand Down

0 comments on commit 250984b

Please sign in to comment.