<div class="rh-button-circle rh-button-circle--default rh-button-circle--xlarge" tabindex="0">
<span class="icon-chevron-up rh-button-circle__icon"></span>
</div>
<div class="{{className}} {{#if priority}}{{className}}--{{priority}}{{else}}{{className}}--default{{/if}} {{className}}--{{modifier}}{{#if hasBorder}} {{className}}--border{{/if}}{{#if extendClass}} {{extendClass}}{{/if}}" tabindex="{{#if tabIndex}}{{tabIndex}}{{else}}0{{/if}}">
<span class="{{icon}}{{#unless isUnderLarge}} {{className}}__icon{{/unless}}"></span>
</div>
{
"className": "rh-button-circle",
"name": "default",
"modifier": "xlarge",
"icon": "icon-chevron-up",
"extendClass": "",
"isUnderLarge": false,
"tabIndex": 0
}
@mixin make-button-circle-size($button-size) {
height: $button-size;
min-height: $button-size; //Fix IE11
max-height: $button-size; //Fix IE11
width: $button-size;
min-width: $button-size; //Fix IE11
max-width: $button-size; //Fix IE11
@content;
}
$classname-button-circle: "rh-button-circle";
.#{$classname-button-circle} {
/* Box-modell/beteende */
display: flex;
justify-content: center;
align-items: center;
/* Visuellt */
border-radius: 50%;
/* Typografi */
font-family: $BUTTON-CIRCLE__ICON--FONT-FAMILY;
text-decoration: none;
@if $BUTTON-CIRCLE__CURSOR {
cursor: $BUTTON-CIRCLE__CURSOR;
}
// Highlight
@if $BUTTON-CIRCLE--BORDER {
&--border {
border: $BUTTON-CIRCLE--BORDER;
}
}
// The empty class is needed when using large and xlarge sizes
&__icon {
}
// Types
&--default {
/* Visuellt */
@if $BUTTON-CIRCLE--DEFAULT-BACKGROUND-COLOR {
background-color: $BUTTON-CIRCLE--DEFAULT-BACKGROUND-COLOR;
}
/* Typografi */
@if $BUTTON-CIRCLE__ICON--DEFAULT-COLOR {
color: $BUTTON-CIRCLE__ICON--DEFAULT-COLOR;
}
&:hover,
&:active,
&:focus {
/* Visuellt */
@if $BUTTON-CIRCLE--DEFAULT-HIGHLIGHT-BACKGROUND-COLOR {
background-color: $BUTTON-CIRCLE--DEFAULT-HIGHLIGHT-BACKGROUND-COLOR;
}
/* Typografi */
@if $BUTTON-CIRCLE__ICON--DEFAULT-HIGHLIGHT-COLOR {
color: $BUTTON-CIRCLE__ICON--DEFAULT-HIGHLIGHT-COLOR;
}
}
}
&--secondary {
/* Visuellt */
@if $BUTTON-CIRCLE--SECONDARY-BACKGROUND-COLOR {
background-color: $BUTTON-CIRCLE--SECONDARY-BACKGROUND-COLOR;
}
/* Typografi */
@if $BUTTON-CIRCLE__ICON--SECONDARY-COLOR {
color: $BUTTON-CIRCLE__ICON--SECONDARY-COLOR;
}
&:hover,
&:active,
&:focus {
/* Visuellt */
@if $BUTTON-CIRCLE--SECONDARY-HIGHLIGHT-BACKGROUND-COLOR {
background-color: $BUTTON-CIRCLE--SECONDARY-HIGHLIGHT-BACKGROUND-COLOR;
}
/* Typografi */
@if $BUTTON-CIRCLE__ICON--SECONDARY-HIGHLIGHT-COLOR {
color: $BUTTON-CIRCLE__ICON--SECONDARY-HIGHLIGHT-COLOR;
}
}
}
&--warning {
/* Visuellt */
@if $BUTTON-CIRCLE--WARNING-BACKGROUND-COLOR {
background-color: $BUTTON-CIRCLE--WARNING-BACKGROUND-COLOR;
}
/* Typografi */
@if $BUTTON-CIRCLE__ICON--WARNING-COLOR {
color: $BUTTON-CIRCLE__ICON--WARNING-COLOR; //false
}
&:hover,
&:active,
&:focus {
/* Visuellt */
@if $BUTTON-CIRCLE--WARNING-HIGHLIGHT-BACKGROUND-COLOR {
background-color: $BUTTON-CIRCLE--WARNING-HIGHLIGHT-BACKGROUND-COLOR;
}
/* Typografi */
@if $BUTTON-CIRCLE__ICON--WARNING-HIGHLIGHT-COLOR {
color: $BUTTON-CIRCLE__ICON--WARNING-HIGHLIGHT-COLOR;
}
}
}
// Sizes
&--small {
@include make-button-circle-size($BUTTON-CIRCLE--SMALL-SIZE);
}
&--medium {
@include make-button-circle-size($BUTTON-CIRCLE--MEDIUM-SIZE);
}
&--large {
@include make-button-circle-size($BUTTON-CIRCLE--LARGE-SIZE) {
.#{$classname-button-circle}__icon {
font-size: $BUTTON-CIRCLE__ICON--LARGE-SIZE;
}
}
}
&--xlarge {
@include make-button-circle-size($BUTTON-CIRCLE--XLARGE-SIZE) {
.#{$classname-button-circle}__icon {
font-size: $BUTTON-CIRCLE__ICON--XLARGE-SIZE;
}
}
}
}
/* Atom - Button circle */
// --------- Base settings ----------
$BUTTON-CIRCLE--SMALL-SIZE: 1.875em; //30px
$BUTTON-CIRCLE--MEDIUM-SIZE: 2.1875em; //35px
$BUTTON-CIRCLE--LARGE-SIZE: 2.5em; //40px
$BUTTON-CIRCLE__ICON--LARGE-SIZE: 1.2em;
$BUTTON-CIRCLE--XLARGE-SIZE: 3.125em; //50px
$BUTTON-CIRCLE__ICON--XLARGE-SIZE: 1.6em;
// ------ End of base settings ------
// --------- Common ----------
$BUTTON-CIRCLE__ICON--FONT-FAMILY: $icon--font-family;
$BUTTON-CIRCLE--BORDER: $border-thin--standard $base3-dark;
$BUTTON-CIRCLE__CURSOR: false; //Ex: pointer
// ------ End of common ------
// --------- Variants ----------
// Default style - HIGHLIGHT === :hover, :active, :focus
$BUTTON-CIRCLE--DEFAULT-BACKGROUND-COLOR: $base3; //false
$BUTTON-CIRCLE__ICON--DEFAULT-COLOR: $white; //false
$BUTTON-CIRCLE--DEFAULT-HIGHLIGHT-BACKGROUND-COLOR: $base3-light; //false
$BUTTON-CIRCLE__ICON--DEFAULT-HIGHLIGHT-COLOR: $base3-dark; //false
// Secondary style
$BUTTON-CIRCLE--SECONDARY-BACKGROUND-COLOR: $base3-light;
$BUTTON-CIRCLE__ICON--SECONDARY-COLOR: $black; //false
$BUTTON-CIRCLE--SECONDARY-HIGHLIGHT-BACKGROUND-COLOR: $base3; //false
$BUTTON-CIRCLE__ICON--SECONDARY-HIGHLIGHT-COLOR: $white; //false
// Warning style
$BUTTON-CIRCLE--WARNING-BACKGROUND-COLOR: $warning-dark;
$BUTTON-CIRCLE__ICON--WARNING-COLOR: $white;
$BUTTON-CIRCLE--WARNING-HIGHLIGHT-BACKGROUND-COLOR: $warning;
$BUTTON-CIRCLE__ICON--WARNING-HIGHLIGHT-COLOR: $white;
// ------ End of variants ------
{
"name": "regionhalland/button-circle",
"description": "Button circle",
"type": "styleguide-atom",
"license": "GPL-3.0",
"authors": [
{
"name": "Roland Hydén",
"email": "Roland.Hyden@Regionhalland.se"
}
],
"require": {}
}
rh-button-circle*
/components/Atoms/button-circle
Klassnamn | Fullständigt namn | Beskrivning |
---|---|---|
--default |
rh-button-circle--default |
|
--secondary |
rh-button-circle--secondary |
|
--warning |
rh-button-circle--warning |
Klassnamn | Fullständigt namn | Mått i em | Mått i pixel |
---|---|---|---|
--small |
rh-button-circle--small |
1.875em | 30px |
--medium |
rh-button-circle--medium |
2.1875em | 35px |
--large |
rh-button-circle--large |
2.5em | 40px |
--xlarge |
rh-button-circle--xlarge |
3.125em | 50px |
Klassnamn | Fullständigt namn | Beskrivning |
---|---|---|
--border |
rh-button-circle--border |
“Border” är runt om komponenten. Standard är utan “border” |
Klassen rh-button-circle__icon
används för att man kan kontrollera ikons stil (storlek, färg o.s.v.). Klassen behövs också när man använder storlekarna --large
och --xlarge
.
Exempel:
<div class="rh-button-circle rh-button-circle--primary rh-button-circle--large">
<span class="icon-arrow-right rh-button-circle__icon"></span>
</div>
TIPS! Man kan också justera ikons position genom att skapa egen CSS-klass och påverka padding*
property. Se nedan för exempel:
.align-icon {
padding-top: 0.1em;
}
<div class="rh-button-circle rh-button-circle--medium align-icon">
<span class="icon-arrow-right"></span>
</div>
rh-button-circle <variant-typ> <variant-storlek>
<div class="rh-button-circle rh-button-circle--primary rh-button-circle--small">
<span class="icon-plus"></span>
</div>
<div class="rh-button-circle rh-button-circle--secondary rh-button-circle--large rh-button-circle--border">
<span class="icon-arrow-right rh-button-circle__icon"></span>
</div>
Man kan också använda <a>
tag runt om komponenten för att det blir länkbar.
<a href="#">
<div class="rh-button-circle rh-button-circle--warning rh-button-circle--small">
<span class="icon-plus"></span>
</div>
</a>
tabindex
--default
skapas.--warning
har skapats..hbs
och .config.json
filer för att ge tydligare HTML i resultatet.:focus
beteendet.1.4em
-> 1.2em
för en bättre passande$button-circle--large-icon-font-size: 1.2em
--secondary
introducerades.