Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix switch-field documentation example [UI-272] #452

Merged

Conversation

teamchong
Copy link
Contributor

@teamchong teamchong commented Feb 21, 2025

Why

The current switch-field documentation contained incorrect examples that were copied from another component, potentially causing confusion and implementation errors.

How

  • Remove incorrect examples from documentation
  • Add proper switch-field examples with appropriate properties

What

Replace the existing example with:

import { createValidatedForm } from '@kurrent-ui/forms';

interface Example {
    notifications: boolean;
    maintenance: boolean;
}

const form = createValidatedForm<Example>({
    notifications: true,
    maintenance: false,
});

export default () => (
    <f2-form>
        <f2-switch-field
            label={'Enable notifications'}
            documentation={
                'Receive real-time updates and alerts about system events'
            }
            {...form.connect('notifications')}
        />
        <f2-switch-field
            disabled
            label={'Maintenance mode'}
            documentation={'This field is disabled'}
            {...form.connect('maintenance')}
        />
    </f2-form>
);

Demo

yarn docs:serve
image

yarn dev fields
image
image

Closes UI-272

@teamchong teamchong self-assigned this Feb 21, 2025
Copy link
Member

@George-Payne George-Payne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but you need to run a yarn build for the CI to pass

@teamchong teamchong force-pushed the teamchong/UI-272-f-2-switch-field-docs-has-wrong-example branch from 6c8aa42 to 230813f Compare February 21, 2025 12:55
@teamchong
Copy link
Contributor Author

Looks good, but you need to run a yarn build for the CI to pass

Built & pushed

@George-Payne George-Payne merged commit 0901959 into main Feb 21, 2025
1 check passed
@George-Payne George-Payne deleted the teamchong/UI-272-f-2-switch-field-docs-has-wrong-example branch February 21, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants