Skip to content

Commit

Permalink
Merge pull request #348 from josemarluedke/chore/move-test-app-demos-gts
Browse files Browse the repository at this point in the history
chore: update test-app components to gts
  • Loading branch information
josemarluedke authored Feb 13, 2025
2 parents 6cf0631 + d9b1e6a commit 3476052
Show file tree
Hide file tree
Showing 30 changed files with 1,296 additions and 1,287 deletions.
9 changes: 5 additions & 4 deletions packages/overlays/src/components/drawer.gts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ export interface DrawerSignature {
Blocks: {
default: [
{
CloseButton: WithBoundArgs<typeof CloseButton, 'onClick'> &
WithBoundArgs<typeof CloseButton, 'class'>;
Header: WithBoundArgs<typeof DrawerHeader, 'labelledById'> &
WithBoundArgs<typeof DrawerHeader, 'classFromParent'>;
CloseButton: WithBoundArgs<typeof CloseButton, 'onClick' | 'class'>;
Header: WithBoundArgs<
typeof DrawerHeader,
'labelledById' | 'classFromParent'
>;
Body: WithBoundArgs<typeof DrawerBody, 'classFromParent'>;
Footer: WithBoundArgs<typeof DrawerFooter, 'classFromParent'>;
headerId: string;
Expand Down
120 changes: 120 additions & 0 deletions test-app/app/components/changeset-form/demo.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import Component from '@glimmer/component';
import validateFormat from 'ember-changeset-validations/validators/format';
import validatePresence from 'ember-changeset-validations/validators/presence';
import countries from './countries';
import ChangesetForm from '@frontile/changeset-form/components/changeset-form/index';
import { Button } from '@frontile/buttons';
// @ts-ignore

Check warning on line 7 in test-app/app/components/changeset-form/demo.gts

View workflow job for this annotation

GitHub Actions / Tests

Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free
import changeset from 'ember-changeset/helpers/changeset';

export const myValidations = {
firstName: validatePresence(true),
lastName: validatePresence(true),
email: validateFormat({ type: 'email' }),
countries: validatePresence(true)
};

interface ExampleArgs {}

export default class Example extends Component<ExampleArgs> {
validations = myValidations;
countries = countries.map((c) => c.name);

model = {
firstName: null,
lastName: null,
email: 'frontile@example.com',
comments: 'Changeset forms are great! 🚀',
countries: [
'Brazil',
'India',
'Israel',
'Japan',
'United Kingdom',
'United States'
],

hungry: true,
humble: true,
curious: true,
favoriteMeal: 'lunch'
};

<template>
{{! @glint-nocheck }}
{{#let (changeset this.model this.validations) as |changeset|}}
<ChangesetForm @changeset={{changeset}} as |Form|>
<Form.Input
@label="First Name"
@fieldName="firstName"
placeholder="What is your first name?"
/>
<Form.Input
@label="Last Name"
@fieldName="lastName"
@containerClass="mt-4"
placeholder="What is your family name?"
/>
<Form.Input
@label="Email Address"
@fieldName="email"
type="email"
@containerClass="mt-4"
/>
<Form.Textarea
@label="Comments"
@fieldName="comments"
@containerClass="mt-4"
/>
<Form.Select
@label="Countries"
@fieldName="countries"
@isMultiple={{true}}
@options={{this.countries}}
@allowClear={{true}}
@containerClass="mt-4"
as |option|
>
{{option}}
</Form.Select>
<Form.CheckboxGroup
@label="Core Values"
@isInline={{true}}
@containerClass="mt-4"
as |Checkbox|
>
<Checkbox @label="Hungry" @fieldName="hungry" />
<Checkbox @label="Humble" @fieldName="humble" />
<Checkbox @label="Curious" @fieldName="curious" />
</Form.CheckboxGroup>
<Form.RadioGroup
@label="Favorite Meal"
@containerClass="mt-4"
@fieldName="favoriteMeal"
as |Radio|
>
<Radio @label="Breakfast" @value="breakfast" />
<Radio @label="Lunch" @value="lunch" />
<Radio @label="Dinner" @value="dinner" />
</Form.RadioGroup>
<Button @type="submit" @class="my-4" disabled={{changeset.isInvalid}}>
Submit
</Button>
<div class="mb-4">
<p>
isPristine:
{{changeset.isPristine}}
</p>
<p>
isValid:
{{changeset.isValid}}
</p>
<p>
isInvalid:
{{changeset.isInvalid}}
</p>
</div>
</ChangesetForm>
{{/let}}
</template>
}
78 changes: 0 additions & 78 deletions test-app/app/components/changeset-form/demo.hbs

This file was deleted.

38 changes: 0 additions & 38 deletions test-app/app/components/changeset-form/demo.ts

This file was deleted.

Loading

0 comments on commit 3476052

Please sign in to comment.