Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/assets/fonts/soramitsu-icons.woff
Binary file not shown.
5 changes: 0 additions & 5 deletions src/assets/icons/activity.svg

This file was deleted.

4 changes: 0 additions & 4 deletions src/assets/icons/arrow-left.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/arrow-top.svg

This file was deleted.

5 changes: 0 additions & 5 deletions src/assets/icons/create.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/email.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/file-upload.svg

This file was deleted.

5 changes: 0 additions & 5 deletions src/assets/icons/globe.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/link-off.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/link-on.svg

This file was deleted.

7 changes: 0 additions & 7 deletions src/assets/icons/log-out.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/more-horizontal.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/play.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/plus.svg

This file was deleted.

12 changes: 0 additions & 12 deletions src/assets/icons/refresh-red.svg

This file was deleted.

12 changes: 0 additions & 12 deletions src/assets/icons/refresh.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/icons/stop.svg

This file was deleted.

5 changes: 0 additions & 5 deletions src/assets/icons/warning.svg

This file was deleted.

43 changes: 36 additions & 7 deletions src/components/Button/SButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:icon="elementIcon"
@click="handleClick"
>
<i v-if="availableIcon" :class="[availableIcon]"></i>
<s-icon v-if="availableIcon" :name="availableIcon" />
<slot></slot>
</el-button>
</s-tooltip>
Expand All @@ -24,11 +24,12 @@ import { Vue, Component, Prop, Inject } from 'vue-property-decorator'
import { ElForm } from 'element-ui/types/form'
import { ElFormItem } from 'element-ui/types/form-item'

import { SIcon } from '../Icon'
import { STooltip } from '../Tooltip'
import { ButtonTypes, ButtonSize, ButtonNativeTypes } from './consts'

@Component({
components: { STooltip }
components: { SIcon, STooltip }
})
export default class SButton extends Vue {
readonly ButtonTypes = ButtonTypes
Expand Down Expand Up @@ -138,9 +139,8 @@ export default class SButton extends Vue {
this.elementIcon = this.icon
return ''
}
// TODO: add checks for invalid icons
this.elementIcon = ''
return `s-icon-${this.icon}`
return this.icon
}

get isLoading (): boolean {
Expand Down Expand Up @@ -235,31 +235,60 @@ export default class SButton extends Vue {
.action {
&.big {
width: $size-big;
i {
font-size: 20px;
}
}
&.medium {
width: $size-medium;
i {
font-size: 18px;
}
}
&.small {
width: $size-small;
i {
font-size: 16px;
margin-left: -2px;
margin-top: -2px;
}
}
color: $color-basic-black;
background-color: $color-neutral-placeholder;
border-color: $color-neutral-placeholder;
&:hover, &:active, &:focus, &:disabled, &:disabled:hover {
color: $color-basic-black;
background-color: $color-neutral-hover;
border-color: $color-neutral-hover;
}
&:disabled, &:disabled:hover {
color: $color-neutral-inactive;
}
&.alternative {
background-color: $color-basic-white;
border-color: $color-neutral-border;
&:hover, &:active, &:focus, &:disabled, &:disabled:hover {
color: $color-basic-black;
background-color: $color-neutral-placeholder;
border-color: $color-neutral-placeholder;
}
&:disabled, &:disabled:hover {
color: $color-neutral-inactive;
}
}
}

button > span > i {
top: -10px;
left: -10px;
button {
> span > i {
&[class^=s-icon-], &[class^=el-icon-] {
display: inline-block;
color: inherit;
}
}
&:not(.action) > span > i {
&[class^=s-icon-], &[class^=el-icon-] {
margin-right: 6px;
}
}
}
</style>
19 changes: 6 additions & 13 deletions src/components/Collapse/SCollapseItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class SCollapseItem extends Vue {

<style lang="scss">
@import "../../styles/variables.scss";
// @import "../../styles/icons.scss";
@import "../../styles/icons.scss";

.without-border {
> div > .el-collapse-item__header,
Expand All @@ -74,24 +74,17 @@ export default class SCollapseItem extends Vue {
&.is-active {
border-bottom-color: transparent;
}
// TODO: fix it. @extend doesn't work in the current implementation
.el-icon-arrow-right {
// @extend .s-icon-arrow-top;
padding: 10px;
// padding: 8px;
font-family: 'soramitsu-icons' !important;
@extend .s-icon-chevron-top;
font-size: 16px;
padding: 8px;
width: 32px;
height: 32px;
background-color: $color-neutral-placeholder;
border-radius: 50%;
&::before {
// content: '';
color: $color-basic-black; // TODO: remove these lines
font-weight: bold;
}
transform: rotate(90deg); // TODO: remove it
&.is-active {
// transform: rotate(180deg);
transform: rotate(270deg);
transform: rotate(180deg);
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/components/Dropdown/SDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<i class="el-icon-arrow-down el-icon--right"></i>
</s-button>
<el-tooltip v-else :disabled="!this.$slots.default || willTooltipBeDisabled">
<i class="s-icon-more"></i>
<i class="s-icon-more-horizontal"></i>
<template slot="content">
<slot></slot>
</template>
Expand Down Expand Up @@ -222,9 +222,8 @@ export default class SDropdown extends Vue {
> i {
cursor: pointer;
}
}
.ellipsis.el-popper[x-placement^=bottom] {
margin-top: 25px;
margin-left: 12px;
.s-icon-more-horizontal {
font-size: 24px;
}
}
</style>
7 changes: 4 additions & 3 deletions src/components/Form/SFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ export default class SFormItem extends Vue {
}
.s-icon-error {
position: absolute;
width: 21px;
height: 21px;
background-position: 4px bottom;
bottom: 0;
left: 4px;
font-size: 16px;
color: $color-error;
}
}
}
Expand Down
50 changes: 50 additions & 0 deletions src/components/Icon/SIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<i v-if="computedClass" :class="computedClass" :style="computedStyles"></i>
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'

import { Icons } from './consts'

@Component
export default class SIcon extends Vue {
/**
* Size property for Icon component.
* It should be `number/string` value which will be used as font-size.
*/
@Prop() readonly size!: number | string
/**
* CSS class name from soramitsu-ui-library without prefix, like
*
* `"s-icon-refresh"` -> `name="refresh"`.
*
* Also, you can use element-ui icons from here: https://element.eleme.io/#/en-US/component/icon
*
* For instance: `name="el-icon-plus"`
*/
@Prop({ type: String, required: true }) readonly name!: string

get computedClass (): string {
if (!this.name) {
return ''
}
if (this.name.startsWith('el-icon')) {
return this.name
}
if (!(Object.values(Icons) as Array<string>).includes(this.name)) {
console.warn(`'${this.name}' was not found`)
return ''
}
return `s-icon-${this.name}`
}

get computedStyles () {
const styles = {} as any
if (this.size) {
styles.fontSize = typeof this.size === 'number' ? `${this.size}px` : this.size
}
return styles
}
}
</script>
Loading