Recently, I wrote a component as Divider
for AureliaToolbelt. You can find it in here
I used the following style and wrote a component based on it.
@-webkit-keyframes spinAround{
from{
-webkit-transform:rotate(0);
transform:rotate(0)
}
to{
-webkit-transform:rotate(359deg);
transform:rotate(359deg)
}
}
@keyframes spinAround{
from{
-webkit-transform:rotate(0);
transform:rotate(0)
}
to{
-webkit-transform:rotate(359deg);
transform:rotate(359deg)
}
}
.is-divider,.is-divider-vertical{
display:block;
position:relative
}
.is-divider-vertical[data-content]::after,.is-divider[data-content]::after{
background:#fff;
color:#b5b5b5;
content:attr(data-content);
display:inline-block;
font-size:.75rem;
padding:.5rem .8rem;
-webkit-transform:translateY(-1.1rem);
transform:translateY(-1.1rem);
text-align:center
}
.is-divider{
border-top:.1rem solid #dbdbdb;
height:.1rem;
margin:2rem 0;
text-align:center
}
.is-divider-vertical{
display:block;
padding:2rem;
position:relative
}
.is-divider-vertical::before{
border-left:.1rem solid #dbdbdb;
bottom:1rem;
content:"";
display:block;
left:50%;
position:absolute;
top:1rem;
-webkit-transform:translateX(-50%);
transform:translateX(-50%)
}
.is-divider-vertical[data-content]::after{
left:50%;
padding:.4rem 0;
position:relative;
top:50%;
-webkit-transform:translate(-50%,-50%);
transform:translate(-50%,-50%)
}
You can see view an viewmodel here too.
Anyone can use this like
<aut-divider vertical>Or</aut-divider>
I used InjectStyles()
for creating a custom style like different colors. but as you see this is a universal style for every aut-divider
that the last style injection effects on all aut-divider
components.
How can I encapsulate each style for each component to have separate style and injection for them while there is a common style for them?