Skip to content

Commit

Permalink
chore: tinker with typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideIadeluca committed Jan 29, 2024
1 parent c07cd44 commit 62ae284
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 24 deletions.
4 changes: 2 additions & 2 deletions js/src/forum/components/Poll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default class IndexPolls extends Component {
<PollImage />
</div>
<div className="Poll-wrapper">
<PollTitle />
<PollDescription />
<PollTitle text="Poll Title" />
<PollDescription text="Poll Description" />
<form>
<fieldset>
<legend className="sr-only">Privacy setting</legend>
Expand Down
14 changes: 7 additions & 7 deletions js/src/forum/components/Poll/PollDescription.tsx
Original file line number Diff line number Diff line change
@@ -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<PollDescriptionAttrs> {
view(): Mithril.Children {
return (
<>
<p className="PollOption-description">Lorem Ipsum Dolor Sit amet Consectetur Adipiscing Elit Sit</p>
</>
);
return <p className="PollOption-description">{this.attrs.text}</p>;
}
}
4 changes: 2 additions & 2 deletions js/src/forum/components/Poll/PollOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default class PollOption extends Component {
aria-describedby="privacy-setting-1-description"
/>
<span className="PollOption-information">
<PollOptionLabel />
<PollOptionDescription />
<PollOptionLabel text="Poll Option Label" />
<PollOptionDescription text="Poll Option Description" />
</span>
</label>
);
Expand Down
10 changes: 7 additions & 3 deletions js/src/forum/components/Poll/PollOptionDescription.tsx
Original file line number Diff line number Diff line change
@@ -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<PollOptionDescriptionAttrs> {
view(): Mithril.Children {
return (
<span id="privacy-setting-1-description" className="PollOption-description">
Only members of this project would be able to access 3
{this.attrs.text}
</span>
);
}
Expand Down
10 changes: 7 additions & 3 deletions js/src/forum/components/Poll/PollOptionLabel.tsx
Original file line number Diff line number Diff line change
@@ -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<PollOptionLabelAttrs> {
view(): Mithril.Children {
return (
<span id="privacy-setting-1-label" className="PollOption-label">
Private to Project Members test 23
{this.attrs.text}
</span>
);
}
Expand Down
14 changes: 7 additions & 7 deletions js/src/forum/components/Poll/PollTitle.tsx
Original file line number Diff line number Diff line change
@@ -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<PollTitleAttrs> {
view(): Mithril.Children {
return (
<>
<p>Polls Title</p>
</>
);
return <p>{this.attrs.text}</p>;
}
}

0 comments on commit 62ae284

Please sign in to comment.