themesberg / themesberg/flowbite-react
Footer as prop not working
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 506
- PR merge metrics
- No merged PRs in 30d
Description
- [X ] I have searched the Issues to see if this bug has already been reported
- [X ] I have tested the latest version
Steps to reproduce
import { Footer } from "flowbite-react";
import { Link } from "react-router-dom";
<Footer container>
<div className="w-full text-center">
<div className="w-full justify-between sm:flex sm:items-center sm:justify-between">
<Footer.Brand
as={Link}
to="/"
src="https://flowbite.com/docs/images/logo.svg"
alt="Flowbite Logo"
name="Flowbite"
/>
<Footer.LinkGroup>
<Footer.Link as={Link} to="/about">
About
</Footer.Link>
<Footer.Link as={Link} to="/contact">
Contact
</Footer.Link>
</Footer.LinkGroup>
</div>
<Footer.Divider />
<Footer.Copyright as={Link} to="/" by="Flowbite™" year={2022} />
</div>
</Footer>
Current behavior
When I assign the as prop to the Footer elements, I get below errors
Type '{ as: ForwardRefExoticComponent<LinkProps & RefAttributes>; to: string; by: string; year: number; }' is not assignable to type 'IntrinsicAttributes & CopyrightProps'.
Property 'as' does not exist on type 'IntrinsicAttributes & CopyrightProps'.
Type '{ children: string; as: ForwardRefExoticComponent<LinkProps & RefAttributes>; to: string; }' is not assignable to type 'IntrinsicAttributes & FooterLinkProps'.
Property 'to' does not exist on type 'IntrinsicAttributes & FooterLinkProps'.
Expected behavior
The Footer component should accept the as prop just like the other components do (such as Sidebar, Navbar etc.)
Context
I am trying to use the as prop
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Footer component definitions and their TypeScript prop types, then compare how Sidebar and Navbar expose the as prop. Reproduce the reported type errors with the example and add coverage for Footer, Footer.Link, and Footer.Copyright accepting the requested props; done when the example type-checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100