Skip to content

Commit

Permalink
icon: add support for inline svg/img (close #523)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishanga committed Jul 1, 2014
1 parent 5ed648a commit f9e816e
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 11 deletions.
52 changes: 52 additions & 0 deletions common.blocks/button/button.tests/simple.bemjson.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@
icon : { block : 'icon', mods : { action : 'download' } }
},
' ',
{
block : 'button',
text : 'layers',
mods : { theme : 'normal', size : 's' },
icon : {
block : 'icon',
content : {
block : 'image',
url : '../../../test.blocks/icon/_action/download.svg'
}
}
},
' ',
{
block : 'button',
mods : { theme : 'normal', size : 's' },
Expand Down Expand Up @@ -249,6 +262,19 @@
icon : { block : 'icon', mods : { action : 'download' } }
},
' ',
{
block : 'button',
text : 'layers',
mods : { theme : 'normal', size : 'm' },
icon : {
block : 'icon',
content : {
block : 'image',
url : '../../../test.blocks/icon/_action/download.svg'
}
}
},
' ',
{
block : 'button',
mods : { theme : 'normal', size : 'm' },
Expand All @@ -266,6 +292,19 @@
icon : { block : 'icon', mods : { action : 'download' } }
},
' ',
{
block : 'button',
text : 'layers',
mods : { theme : 'normal', size : 'l' },
icon : {
block : 'icon',
content : {
block : 'image',
url : '../../../test.blocks/icon/_action/download.svg'
}
}
},
' ',
{
block : 'button',
mods : { theme : 'normal', size : 'l' },
Expand All @@ -283,6 +322,19 @@
icon : { block : 'icon', mods : { action : 'download' } }
},
' ',
{
block : 'button',
text : 'layers',
mods : { theme : 'normal', size : 'xl' },
icon : {
block : 'icon',
content : {
block : 'image',
url : '../../../test.blocks/icon/_action/download.svg'
}
}
},
' ',
{
block : 'button',
mods : { theme : 'normal', size : 'xl' },
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/icon/icon.roo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
background: 50% no-repeat;

/* Hack for correct baseline positioning */
&:after
&:empty:after
{
visibility: hidden;

Expand Down
2 changes: 1 addition & 1 deletion common.blocks/icon/icon.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
background: 50% no-repeat;

/* Hack for correct baseline positioning */
&:after
&:empty:after
{
visibility: hidden;

Expand Down
47 changes: 39 additions & 8 deletions common.blocks/icon/icon.tests/simple.bemjson.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,49 @@
{ tag : 'h2', content : 'icon' },
{
block : 'test',
content : {
block : 'icon',
url : '../../../test.blocks/icon/_action/download.svg'
}
content : [
'Style background: ',
{
block : 'icon',
url : '../../../test.blocks/icon/_action/download.svg'
}
]
},
{ tag : 'br' },
{
block : 'test',
content : {
block : 'icon',
mods : { social : 'twitter' }
}
content : [
'CSS background: ',
{
block : 'icon',
mods : { action : 'download' }
}
]
},
{ tag : 'br' },
{
block : 'test',
content : [
'Source content: ',
{
block : 'icon',
content : {
block : 'image',
url : '../../../test.blocks/icon/_action/download.svg'
}
}
]
},
{ tag : 'br' },
{
block : 'test',
content : [
'Inline content: ',
{
block : 'icon',
content : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M1 13v2h14v-2h-14zm13-7h-3v-5h-6v5.031l-3-.031 6 6 6-6z"/></svg>'
}
]
}
]
});
2 changes: 1 addition & 1 deletion test.blocks/icon/icon.roo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.icon
{
width: 1em;
min-width: 1em;
}

0 comments on commit f9e816e

Please sign in to comment.