-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(common-css): add label, heading, text to common css [ci visual]
- Loading branch information
1 parent
e663163
commit cf25ece
Showing
10 changed files
with
203 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
@import 'common-settings'; | ||
@import 'common-mixins'; | ||
|
||
$block: #{$sap-namespace}-label; | ||
|
||
@mixin sap-label($required: false, $colon: false) { | ||
@include sap-reset(); | ||
@include sap-ellipsis(); | ||
@include sap-set-margin-end(0.5rem); | ||
|
||
cursor: text; | ||
max-width: 100%; | ||
width: fit-content; | ||
position: relative; | ||
align-self: flex-start; | ||
font-size: var(--sapFontSize); | ||
color: var(--sapContent_LabelColor); | ||
|
||
&.is-disabled { | ||
opacity: 0.4; | ||
} | ||
|
||
@if $required == true { | ||
@include sap-set-padding-end(0.5rem); | ||
|
||
&::after { | ||
top: 0; | ||
right: 0; | ||
content: '*'; | ||
font-weight: bold; | ||
position: absolute; | ||
font-size: var(--sapFontLargeSize); | ||
color: var(--sapField_RequiredColor); | ||
} | ||
|
||
@include sap-rtl() { | ||
&::after { | ||
left: 0; | ||
right: auto; | ||
} | ||
} | ||
} | ||
|
||
@if $colon == true { | ||
@include sap-set-padding-end(0.25rem); | ||
|
||
&::before { | ||
top: 0; | ||
right: 0; | ||
content: ':'; | ||
color: inherit; | ||
position: absolute; | ||
font-size: var(--sapFontSize); | ||
} | ||
|
||
@include sap-rtl() { | ||
&::before { | ||
left: 0; | ||
right: auto; | ||
} | ||
} | ||
} | ||
|
||
@if $required == true and $colon == true { | ||
@include sap-set-padding-end(0.75rem); | ||
|
||
&::after { | ||
top: 0; | ||
right: 0; | ||
content: '*'; | ||
font-weight: bold; | ||
position: absolute; | ||
font-size: var(--sapFontLargeSize); | ||
color: var(--sapField_RequiredColor); | ||
} | ||
|
||
&::before { | ||
top: 0; | ||
right: 0.5rem; | ||
content: ':'; | ||
color: inherit; | ||
position: absolute; | ||
font-size: var(--sapFontSize); | ||
} | ||
|
||
@include sap-rtl() { | ||
&::before { | ||
right: auto; | ||
left: 0.5rem; | ||
} | ||
|
||
&::after { | ||
left: 0; | ||
right: auto; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.#{$sap-namespace}-label { | ||
@include sap-label(); | ||
} | ||
|
||
.#{$sap-namespace}-label-required { | ||
@include sap-label($required: true); | ||
} | ||
|
||
.#{$sap-namespace}-label-colon { | ||
@include sap-label($colon: true); | ||
} | ||
|
||
.#{$sap-namespace}-label-colon-required { | ||
@include sap-label($required: true, $colon: true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/common-css/stories/label/default-example.example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<label class="sap-label">Default Label</label> | ||
<br> | ||
<label class="sap-label-required">Required Label</label> | ||
<br> | ||
<label class="sap-label-colon">Colon Label</label> | ||
<br> | ||
<label class="sap-label-colon-required">Required Colon Label</label> | ||
<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import defaultExampleExampleHtml from "./default-example.example.html?raw"; | ||
import '../../src/sap-label.scss'; | ||
|
||
export default { | ||
title: 'Label', | ||
parameters: { | ||
description: `The following classes and mixin provide a way to style your labels per SAP design. | ||
<br><br> | ||
<b>CSS Classes: </b><br><br> | ||
<code>.sap-label</code><br> | ||
<code>.sap-label-required</code><br> | ||
<code>.sap-label-colon</code><br> | ||
<code>.sap-label-colon-required</code><br><br><br> | ||
<b>SCSS Mixin: </b> | ||
<code>@include sap-label(<i style="color: red;">$required, $colon</i>)</code><br> | ||
where <i style="color: red;">$required</i> and <i style="color: red;">$colon</i> are optional and can be set individually. <br> | ||
- <code>@include sap-label($required: true)</code>: to display a label with asterisk<br> | ||
- <code>@include sap-label($colon: true)</code>: to display a label with colon<br> | ||
- <code>@include sap-label($required: true, $colon: true)</code>: to display a label with asterisk and colon<br>` | ||
} | ||
}; | ||
export const DefaultExample = () => defaultExampleExampleHtml; | ||
DefaultExample.storyName = 'Examples'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters