Skip to content

Commit

Permalink
fix: column, support span with md, sm and lg
Browse files Browse the repository at this point in the history
  • Loading branch information
si3nloong committed Dec 31, 2020
1 parent ce201fd commit 96743cd
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions packages/column/src/Column.svelte
Expand Up @@ -9,9 +9,9 @@
export let justify = "center";
export let style = "";
let classes = `responsive-ui-column--${span}`;
let cls = `responsive-ui-column--${span}`;
if (isNaN(Number(span))) {
classes = Object.entries(<Device>span)
cls = Object.entries(<Device>span)
.map(([k, v]) => `responsive-ui-column--${k}-${v}`)
.join(" ");
}
Expand Down Expand Up @@ -116,23 +116,24 @@
flex: 0 0 $width;
max-width: $width;
}
&--4 {
$width: 16.66666667%;
&--1 {
$width: 4.16666667%;
flex: 0 0 $width;
max-width: $width;
}
&--3 {
$width: 12.5%;
&--2 {
$width: 8.33333333%;
flex: 0 0 $width;
max-width: $width;
}
&--2 {
$width: 8.33333333%;
&--3 {
$width: 12.5%;
flex: 0 0 $width;
max-width: $width;
}
&--1 {
$width: 4.16666667%;
&--4 {
$width: 16.66666667%;
flex: 0 0 $width;
max-width: $width;
}
Expand All @@ -148,6 +149,21 @@
@media (max-width: 480px) {
.responsive-ui-column {
&--sm-1 {
$width: 4.16666667%;
flex: 0 0 $width;
max-width: $width;
}
&--sm-2 {
$width: 8.33333333%;
flex: 0 0 $width;
max-width: $width;
}
&--sm-3 {
$width: 12.5%;
flex: 0 0 $width;
max-width: $width;
}
&--sm-4 {
$width: 16.66666667%;
flex: 0 0 $width !important;
Expand Down Expand Up @@ -177,6 +193,6 @@
}
</style>

<div class={`responsive-ui-column--${justify} ${classes} ${className}`} {style}>
<div class={`responsive-ui-column--${justify} ${cls} ${className}`} {style}>
<slot />
</div>

0 comments on commit 96743cd

Please sign in to comment.