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: toggle follow fiori3 #492

Merged
merged 11 commits into from Jan 17, 2020
Merged

feat: toggle follow fiori3 #492

merged 11 commits into from Jan 17, 2020

Conversation

JKMarkowski
Copy link
Contributor

@JKMarkowski JKMarkowski commented Dec 5, 2019

Related Issue

Closes #456
Closes #535

Description

There are is new toggle, which follows fiori3 specs

Breaking changes

  • Completely new structure of toggle in every mode. Added classes:
    fd-toggle__text - To put some text (max 3 chars) inside toggle.
    fd-toggle__wrapper, fd-toggle__track.
  • Removed size classes (--xs, --s, --m, --l, --xl)

Screenshots

NOTE: If you've made any style changes, please provide appropriate screenshots (before and after) to help reviewers.

To see examples of which screenshots to include, go to Screenshot Examples.

Before:

image
image
image
image

After:

image
image
image
image

@netlify
Copy link

netlify bot commented Dec 5, 2019

Deploy preview for fundamental-styles ready!

Built with commit f43b06b

https://deploy-preview-492--fundamental-styles.netlify.com

src/toggle.scss Show resolved Hide resolved
src/toggle.scss Outdated Show resolved Hide resolved
src/toggle.scss Outdated Show resolved Hide resolved
@@ -84,5 +84,8 @@ $block: #{$fd-namespace}-form-label;
overflow: initial;
margin-top: 5px;
margin-bottom: 5px;
display: flex;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor

@InnaAtanasova InnaAtanasova left a comment

Choose a reason for hiding this comment

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

Since we are introducing Breaking changes for this component I think it's a good idea to also rename the classes from toggle to switch


{% capture default %}
<div class="fd-form-group">
<div class="fd-form-item">
<label class="fd-form-label" for="y21YO391">Live:</label>
<label class="fd-form-label">Toggle with label</label>
<label class="fd-form-label fd-form-label--toggle">
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make the toggle component dependent on fd-form-label. Can you create a new class and if you depend a lot on fd-form-label maybe create a mixin and include it here.

<input class="fd-toggle__input" type="checkbox" name="" value="" id="y21YO3911">
<div class="fd-toggle__wrapper">
<div class="fd-toggle__inner">
<span class="fd-toggle__label fd-toggle__label--on">on</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

fd-switch__text

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to use fd-toggle__label not only for text, it's also for icons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will use __text, because __label is reserved for labels

<div class="fd-toggle__wrapper">
<div class="fd-toggle__inner">
<span class="fd-toggle__label fd-toggle__label--on">on</span>
<span class="fd-toggle__switch" role="presentation"></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

fd-switch__handle

<span class="fd-toggle__switch" role="presentation"></span>
<input class="fd-toggle__input" type="checkbox" name="" value="" id="y21YO3911">
<div class="fd-toggle__wrapper">
<div class="fd-toggle__inner">
Copy link
Contributor

Choose a reason for hiding this comment

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

fd-switch__track

src/toggle.scss Outdated
background-color: $fd-toggle-inactive-switch-background;
width: $fd-toggle-switch-size;
height: $fd-toggle-switch-size;
border-radius: $fd-toggle-switch-border-radius;
Copy link
Contributor

Choose a reason for hiding this comment

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

missing background-clip: padding-box;

src/toggle.scss Outdated
$fd-toggle-container-padding-y: 0.375rem;
$fd-toggle-size-x: 3.75rem;
$fd-toggle-size-y: 1.25rem;
$fd-toggle-switch-size: 1.875rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it 2rem?

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 is, but actually it's counted with (2* 0.0625rem) border, so it gives 2rem.

@InnaAtanasova InnaAtanasova added this to In progress in Development via automation Jan 6, 2020
@InnaAtanasova InnaAtanasova added this to the Sprint 28 - Sydney milestone Jan 6, 2020
@InnaAtanasova InnaAtanasova moved this from In progress to Review in progress in Development Jan 6, 2020
@JKMarkowski
Copy link
Contributor Author

All of the comments are solved now. It's ready to second review.

<span class="fd-toggle">
<input class="fd-toggle__input" type="checkbox" name="" value="" id="y21YO391">
<span class="fd-toggle__switch" role="presentation"></span>
<label class="fd-form-label">Toggle with label</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you only use the switch label?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Labels are not stricly connected to switch. So I don't think so

@InnaAtanasova
Copy link
Contributor

InnaAtanasova commented Jan 14, 2020

  1. The elements are not focusable and the keyboard support is missing
  2. There's bleeding of styles - check the un-normalize in the Playground

Screen Shot 2020-01-14 at 3 21 17 PM

You need to reset the fd-switch__wrapper, fd-switch__track, and fd-switch__handle.
You will get something like:

Screen Shot 2020-01-14 at 3 55 47 PM

@InnaAtanasova
Copy link
Contributor

Screen Shot 2020-01-15 at 1 39 55 PM

Screen Shot 2020-01-15 at 1 38 54 PM

The tests are failing because the "handle" moved a bit (prob because of the resets). I think it's related to the left: calc(1.8125rem - 100%); for fd-switch__track.

@stefanoScalzo stefanoScalzo self-requested a review January 16, 2020 17:48
Development automation moved this from PRs Review in progress to PRs Reviewer approved Jan 16, 2020
@bcullman
Copy link
Contributor

can we see a before and after screen shots on the PR description?

@JKMarkowski JKMarkowski merged commit a4c40a3 into master Jan 17, 2020
Development automation moved this from PRs Reviewer approved to Done Jan 17, 2020
@JKMarkowski JKMarkowski deleted the fix/456-toggle branch January 17, 2020 14:36
@JKMarkowski
Copy link
Contributor Author

@bcullman I noticed your comments too late, after merging this commit. But it has been tested and compared to fiori3 specs and everything works correct.

@bcullman
Copy link
Contributor

@thanks @JKMarkowski looks great! Thats been wrong for a long time. Glad thats been fixed.

I did note one other oddity on the alert - when in RTL mode, the close button is off by pixel from the edge. See

image

vs rtl

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fiori 3 refactoring match Fiori 3 requirements
Projects
Development
  
Done
Development

Successfully merging this pull request may close these issues.

Toggle switch handle trimmed, no switch animation Refactor Toggle to match Fiori 3 specs and the sap-theming
4 participants