-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1555 from kiva/VUE-223_kv-icon-slimsprite
VUE-223 KvIcon: dynamically inline most icons, sprite common icons
- Loading branch information
Showing
250 changed files
with
781 additions
and
4,389 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
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,94 @@ | ||
import KvIcon from '@/components/Kv/KvIcon'; | ||
|
||
function getFilenames(r) { | ||
return r.keys().map((filename) => { | ||
let str = filename; | ||
str = str.substring(2); // remove ./ | ||
str = str.substring(0, str.length - 4); // remove .svg | ||
return str; | ||
}); | ||
} | ||
|
||
export default { | ||
title: 'Kv/KvIcon', | ||
component: KvIcon, | ||
}; | ||
|
||
export const Default = () => ({ | ||
components: { | ||
KvIcon | ||
}, | ||
template: ` | ||
<div> | ||
<kv-icon name="print" style="width: 10rem; fill: orange;" /> | ||
</div> | ||
`, | ||
}); | ||
|
||
export const inlined = () => ({ | ||
components: { | ||
KvIcon | ||
}, | ||
data() { | ||
return { | ||
iconNames: getFilenames(require.context('@/assets/icons/inline/', true, /\.svg$/)) | ||
} | ||
}, | ||
template: ` | ||
<ul style=" | ||
list-style: none; | ||
display: grid; | ||
grid-gap: 3rem; | ||
grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); | ||
"> | ||
<li | ||
v-for="iconName in iconNames" | ||
:key="iconName" | ||
style=" | ||
display: grid; | ||
grid-template-rows: 7rem auto; | ||
align-items: center; | ||
text-align: center; | ||
font-size: 0.75rem; | ||
" | ||
> | ||
<kv-icon :name="iconName" /> | ||
<div>{{ iconName }}</div> | ||
</li> | ||
</ul> | ||
`, | ||
}); | ||
|
||
export const fromSprite = () => ({ | ||
components: { | ||
KvIcon | ||
}, | ||
data() { | ||
return { | ||
iconNames: getFilenames(require.context('@/assets/icons/sprite/', true, /\.svg$/)) | ||
} | ||
}, | ||
template: ` | ||
<ul style=" | ||
list-style: none; | ||
display: grid; | ||
grid-gap: 3rem; | ||
grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); | ||
"> | ||
<li | ||
v-for="iconName in iconNames" | ||
:key="iconName" | ||
style=" | ||
display: grid; | ||
grid-template-rows: 7rem auto; | ||
align-items: center; | ||
text-align: center; | ||
font-size: 0.75rem; | ||
" | ||
> | ||
<kv-icon :name="iconName" :from-sprite="true" /> | ||
<div>{{ iconName }}</div> | ||
</li> | ||
</ul> | ||
`, | ||
}); |
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
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
Oops, something went wrong.