Skip to content

Conversation

@Linn-Devoteam
Copy link
Contributor

@Linn-Devoteam Linn-Devoteam commented Aug 7, 2025

Pull Request

Description

This PR finalizes the Fab (Floating Action Button) component.
It includes:

  • Props for background color, text color, and size
  • Default fallback content (a + icon)
  • Integration with theme tokens for spacing, size, border radius, etc.
  • Installation of react-icons for default icon support
  • Updates to the theme and token structure
  • A simple usage example with onClick handling

How to test

  1. Install and start the project:

    • npm install
    • npm run dev
  2. Add the Fab component to App.tsx for testing

import Fab from './components/common/atoms/Fab/Fab'

function App() {
  const handleClick = () => {
    alert('Clicked!')
  }

  return (
    <>
      < Fab onClick={handleClick} /> 
  • Optional: try passing props like bgColor, or size
< Fab
  onClick={handleClick}
  bgColor="secondary"
  size="LARGE"
/>
  1. Save the file and go to the browser. You should see a round button appear (default + icon). When you click it, an alert should pop up.

Type of Change

  • feature: New feature
  • chore: Maintenance, dependency updates, or refactoring
  • test: Adding or improving tests
  • bug: Bug fix
  • docs: Documentation updates
  • Other (please specify):

Shortcut story

https://trello.com/c/vVWL3MCh

Related Issues

Testing Performed

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Screenshots/Recordings

Screenshot 2025-08-07 at 16 37 03 Screenshot 2025-08-07 at 16 36 53

Checklist

  • My code follows the project's coding style guidelines
  • I have updated the documentation accordingly
  • I have added tests that prove my fix/feature works
  • All existing and new tests pass
  • I have checked for and resolved any merge conflicts
  • I have made corresponding changes to the README (if applicable)

Additional Notes

@Linn-Devoteam Linn-Devoteam changed the title finalize Fab component with size and color props, token support, and … feature/sc-1/finalize-fab-component Aug 7, 2025
Copy link
Collaborator

@JasminePRA JasminePRA left a comment

Choose a reason for hiding this comment

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

added comments

| 'secondary'
| 'danger'
| 'success'
| 'warning'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why remove info?

Copy link
Contributor Author

@Linn-Devoteam Linn-Devoteam Aug 11, 2025

Choose a reason for hiding this comment

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

Since info dont have a color in theme, I add a color for info in theme and it will work.

| 'success'
| 'warning'
export type FabTextColor = 'primary' | 'secondary' | 'white'
export type Fabsize = 'SMALL' | 'MEDIUM' | 'LARGE'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why capitalized?

Copy link
Contributor Author

@Linn-Devoteam Linn-Devoteam Aug 11, 2025

Choose a reason for hiding this comment

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

Since the size is linked to the token and token is written in Uppercase. I change the Fabsize in token to sm, md, lg. And update the Fab component

| 'danger'
| 'success'
| 'warning'
export type FabTextColor = 'primary' | 'secondary' | 'white'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why white? primary and secondary should be fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depends on your current primary and secondary text colors. I can update the secondary color to white, and then it will work.

Comment on lines 16 to 24
bgColor?: FabBgColor
textColor?: FabTextColor
size?: Fabsize
position?: 'absolute' | 'fixed' | 'relative'
bottom?: number
right?: number
top?: number
left?: number
zIndex?: number
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are they all optional? think about what is necessary for the fab to be a fab

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

left: ${({ left }) => left ?? 'auto'};
z-index: ${({ zIndex }) => zIndex ?? 1000};
`;
export const Container = styled.button<{
Copy link
Collaborator

Choose a reason for hiding this comment

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

a button is not a container though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change to div

@Linn-Devoteam Linn-Devoteam changed the title feature/sc-1/finalize-fab-component Finalize FAB: fixed placement and tokens-based styling Aug 13, 2025
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.

3 participants