-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support segmented fallback less
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
@class-prefix-segmented: ~'adm-segmented'; | ||
|
||
.@{class-prefix-segmented} { | ||
display: inline-block; | ||
padding: 2px; | ||
color: #666; | ||
background-color: #f5f5f5; | ||
border-radius: 2px; | ||
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); | ||
|
||
&-group { | ||
position: relative; | ||
display: flex; | ||
align-items: stretch; | ||
justify-items: flex-start; | ||
width: 100%; | ||
} | ||
|
||
// block styles | ||
&&-block { | ||
display: flex; | ||
} | ||
|
||
&&-block &-item { | ||
flex: 1; | ||
min-width: 0; | ||
} | ||
|
||
// item styles | ||
&-item { | ||
position: relative; | ||
text-align: center; | ||
cursor: pointer; | ||
transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); | ||
|
||
&-selected { | ||
.segmented-item-selected(); | ||
color: #333; | ||
} | ||
|
||
&-label { | ||
min-height: 10px; | ||
padding: 0 11px; | ||
line-height: 28px; | ||
.segmented-text-ellipsis(); | ||
} | ||
|
||
// syntactic sugar to add `icon` for Segmented Item | ||
&-icon + * { | ||
margin-left: 6px; | ||
} | ||
|
||
&-input { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 0; | ||
height: 0; | ||
opacity: 0; | ||
pointer-events: none; | ||
} | ||
} | ||
|
||
// disabled styles | ||
&-item-disabled { | ||
.segmented-disabled-item(); | ||
} | ||
|
||
// thumb styles | ||
&-thumb { | ||
.segmented-item-selected(); | ||
|
||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 0; | ||
height: 100%; | ||
padding: 4px 0; | ||
} | ||
|
||
// transition effect when `appear-active` | ||
&-thumb-motion-appear-active { | ||
transition: | ||
transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), | ||
width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); | ||
will-change: transform, width; | ||
} | ||
} | ||
|
||
/* ---- mixins part starts ---- */ | ||
.segmented-disabled-item { | ||
color: #999; | ||
cursor: not-allowed; | ||
} | ||
|
||
.segmented-item-selected { | ||
background-color: #fff; | ||
border-radius: 2px; | ||
box-shadow: | ||
0 2px 8px -2px fade(#000, 5%), | ||
0 1px 4px -1px fade(#000, 7%), | ||
0 0 1px 0 fade(#000, 8%); | ||
} | ||
|
||
.segmented-text-ellipsis { | ||
overflow: hidden; | ||
// handle text ellipsis | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
word-break: keep-all; | ||
} | ||
/* ---- mixins part ends ---- */ |
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