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

Feat/collapsible provider state #5043

Merged
merged 4 commits into from
Feb 9, 2024
Merged

Conversation

JarrodMFlesch
Copy link
Contributor

Description

Adds useful context to the useCollapsible hook and exports it for easier import.

Example usage:

import React from 'react'

import { useCollapsible } from 'payload/components/utilities'

const CustomComponent: React.FC = () => {
  const { collapsed, toggle } = useCollapsible()
  return (
    <div>
      <p className="field-type">I am {collapsed ? 'closed' : 'open'}</p>
      <button onClick={toggle} type="button">
        Toggle
      </button>
    </div>
  )
}
  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes
  • I have made corresponding changes to the documentation

@JarrodMFlesch JarrodMFlesch merged commit df39602 into main Feb 9, 2024
31 checks passed
@JarrodMFlesch JarrodMFlesch deleted the feat/collapsible-provider-state branch February 9, 2024 15:38
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.

1 participant