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

[FR] Best Toggle UI design #461

Open
cprodhomme opened this issue Apr 13, 2023 · 1 comment
Open

[FR] Best Toggle UI design #461

cprodhomme opened this issue Apr 13, 2023 · 1 comment

Comments

@cprodhomme
Copy link
Contributor

cprodhomme commented Apr 13, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I have recently change the style of your toggle with a design more modern in arctic_admin :

Capture d’écran 2023-04-13 à 16 18 39

Describe the solution you'd like
A clear and concise description of what you want to happen.

I ask if you want to reuse the style or not ? :)

I can made the pull request if you want some help

Additional context
*Add any other context or screenshots about the feature request here.(

The style i use :

Just thinks to remove the between the // reset style

$toggle-width: 40px !default;
$toggle-height: 20px !default;
$toggle-offset: 3px !default;

$toggle-outer-default: #ddd !default;
$toggle-outer-active: $primary-color !default;
$toggle-inner-default: #fff !default;
$toggle-inner-active: #fff !default;

$toggle-transition: 200ms ease-out !default;

.toggle-bool-switches-container {

  text-align: left;

  .toggle-bool-switch {
    // reset style
    background-image: none;
    box-shadow: none;
    //

    cursor: pointer;

    position: relative;
    display: inline-flex;
    align-items: center;
    width: $toggle-width;
    height: $toggle-height;
    background-color: $toggle-outer-default;
    border-radius: 100vw;
    cursor: pointer;
    transition: $toggle-transition;

    &::before {
      // reset style
      height: auto;
      width: auto;
      background-image: none;
      //


      content: "";
      position: absolute;
      top: $toggle-offset;
      left: $toggle-offset;
      bottom: $toggle-offset;
      
      aspect-ratio: 1 / 1;
      
      background-color: $toggle-inner-default;
      border-radius: 50%;
      box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.05);
      transition: $toggle-transition;
    }

    &.on {
      // reset style
      background-image: none;
      //
      background: $primary-color;

      &::before {
        // reset style
        left: $toggle-offset;
        //

        background-color: $toggle-inner-active;
        transform: translateX(
          calc($toggle-width - $toggle-height)
        );
      }
    }
  }
}
@difernandez
Copy link
Contributor

difernandez commented Apr 14, 2023

Thanks for your suggestion, we actually use arctic_admin in many of our projects, so thank you for your work in that gem too! I think the new design does indeed look better and more modern, and I think it wouldn't look too out of place in the default activeadmin theme too. At a glance the changes look good, if you could open a PR with them I'd be happy to review it and give them a closer look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants