From 62ae2846836485893e80a909b65d7e8a01a6fd08 Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Mon, 29 Jan 2024 11:13:49 +0100 Subject: [PATCH] chore: tinker with typescript --- js/src/forum/components/Poll.tsx | 4 ++-- js/src/forum/components/Poll/PollDescription.tsx | 14 +++++++------- js/src/forum/components/Poll/PollOption.tsx | 4 ++-- .../components/Poll/PollOptionDescription.tsx | 10 +++++++--- js/src/forum/components/Poll/PollOptionLabel.tsx | 10 +++++++--- js/src/forum/components/Poll/PollTitle.tsx | 14 +++++++------- 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/js/src/forum/components/Poll.tsx b/js/src/forum/components/Poll.tsx index ad3684b5..795f357a 100644 --- a/js/src/forum/components/Poll.tsx +++ b/js/src/forum/components/Poll.tsx @@ -14,8 +14,8 @@ export default class IndexPolls extends Component {
- - + +
Privacy setting diff --git a/js/src/forum/components/Poll/PollDescription.tsx b/js/src/forum/components/Poll/PollDescription.tsx index 47327798..2c93efef 100644 --- a/js/src/forum/components/Poll/PollDescription.tsx +++ b/js/src/forum/components/Poll/PollDescription.tsx @@ -1,12 +1,12 @@ import * as Mithril from 'mithril'; -import Component from 'flarum/common/Component'; +import Component, { ComponentAttrs } from 'flarum/common/Component'; -export default class PollDescription extends Component { +interface PollDescriptionAttrs extends ComponentAttrs { + text: String; +} + +export default class PollDescription extends Component { view(): Mithril.Children { - return ( - <> -

Lorem Ipsum Dolor Sit amet Consectetur Adipiscing Elit Sit

- - ); + return

{this.attrs.text}

; } } diff --git a/js/src/forum/components/Poll/PollOption.tsx b/js/src/forum/components/Poll/PollOption.tsx index 99f50eef..b3b4a118 100644 --- a/js/src/forum/components/Poll/PollOption.tsx +++ b/js/src/forum/components/Poll/PollOption.tsx @@ -16,8 +16,8 @@ export default class PollOption extends Component { aria-describedby="privacy-setting-1-description" /> - - + + ); diff --git a/js/src/forum/components/Poll/PollOptionDescription.tsx b/js/src/forum/components/Poll/PollOptionDescription.tsx index 5b6591b8..a0815339 100644 --- a/js/src/forum/components/Poll/PollOptionDescription.tsx +++ b/js/src/forum/components/Poll/PollOptionDescription.tsx @@ -1,11 +1,15 @@ import * as Mithril from 'mithril'; -import Component from 'flarum/common/Component'; +import Component, { ComponentAttrs } from 'flarum/common/Component'; -export default class PollOptionDescription extends Component { +interface PollOptionDescriptionAttrs extends ComponentAttrs { + text: String; +} + +export default class PollOptionDescription extends Component { view(): Mithril.Children { return ( - Only members of this project would be able to access 3 + {this.attrs.text} ); } diff --git a/js/src/forum/components/Poll/PollOptionLabel.tsx b/js/src/forum/components/Poll/PollOptionLabel.tsx index 05d78404..8cc5a526 100644 --- a/js/src/forum/components/Poll/PollOptionLabel.tsx +++ b/js/src/forum/components/Poll/PollOptionLabel.tsx @@ -1,11 +1,15 @@ import * as Mithril from 'mithril'; -import Component from 'flarum/common/Component'; +import Component, { ComponentAttrs } from 'flarum/common/Component'; -export default class PollOptionLabel extends Component { +interface PollOptionLabelAttrs extends ComponentAttrs { + text: String; +} + +export default class PollOptionLabel extends Component { view(): Mithril.Children { return ( - Private to Project Members test 23 + {this.attrs.text} ); } diff --git a/js/src/forum/components/Poll/PollTitle.tsx b/js/src/forum/components/Poll/PollTitle.tsx index b2848f3d..690457e1 100644 --- a/js/src/forum/components/Poll/PollTitle.tsx +++ b/js/src/forum/components/Poll/PollTitle.tsx @@ -1,12 +1,12 @@ import * as Mithril from 'mithril'; -import Component from 'flarum/common/Component'; +import Component, { ComponentAttrs } from 'flarum/common/Component'; -export default class PollTitle extends Component { +interface PollTitleAttrs extends ComponentAttrs { + text: String; +} + +export default class PollTitle extends Component { view(): Mithril.Children { - return ( - <> -

Polls Title

- - ); + return

{this.attrs.text}

; } }