Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end-of-line = lf
indent-size = 4
indent-style = space
insert-final-new-line = true
trim-trailing-whitespace = true

[*.md]
trim-trailing-whitespace = false
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.idea
node_modules
npm-debug.log
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- stable
11 changes: 11 additions & 0 deletions blocks/modal-overlay/modal-overlay.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.modal-overlay {
position: absolute;
left: -100%;
top: 0;
width: 300%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
visibility: hidden;
opacity: 0;
transition: all .5s ease-in-out .2s;
}
3 changes: 3 additions & 0 deletions blocks/page/_view/page_view_error.bemtree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
block('page').mod('view', 'error').content()(function() {
return 'error';
});
46 changes: 46 additions & 0 deletions blocks/page/_view/page_view_index.bemtree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
block('page').mod('view', 'index').replace()(function() {
var ctx = this.ctx;

return [
'<!DOCTYPE html>',
{
tag: 'html',
attrs: {
lang: 'ru'
},
content: [
{
tag: 'head',
content: [
{
tag: 'meta',
attrs: {
charset: 'utf-8'
}
},
{
tag: 'title',
content: ctx.title
},
ctx.styles.map(function(style) {
return {
tag: 'link',
attrs: {
rel: 'stylesheet',
href: style.url
}
};
})
]
},
{
tag: 'body',
cls: 'page page_view_index',
content: {
block: 'wrapper'
}
}
]
}
];
});
3 changes: 3 additions & 0 deletions blocks/page/_view/page_view_index.deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
({
shouldDeps: { block: 'wrapper' }
})
12 changes: 12 additions & 0 deletions blocks/page/page.deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
({
shouldDeps: [
{
mods: {
view: [
'index',
'error'
]
}
}
]
})
30 changes: 30 additions & 0 deletions blocks/page/page.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
html
{
padding: 0;
margin: 0;
min-height: 100vh;
box-sizing: border-box;
}

*,
*::before,
*::after
{
box-sizing: inherit;
}

.page
{
height: 100vh;
padding: 0;
margin: 0;
font-family: 'Noto Sans', sans-serif;
font-size: 14px;
font-weight: normal;
color: #000;
display: flex;
justify-content: center;
background-image: linear-gradient(90deg, rgba(200, 0, 0, .5) 50%, transparent 50%),
linear-gradient(rgba(200, 0, 0, .5) 50%, transparent 50%);
background-size: 50px 50px;
}
4 changes: 4 additions & 0 deletions blocks/radio/_view/radio_view_hidden.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.radio_view_hidden
{
display: none;
}
23 changes: 23 additions & 0 deletions blocks/radio/radio.bemhtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
block('radio')(
tag()('input'),
attrs()({type: 'radio'}),

mod('type', 'vegetable').replace()(function() {
var content = this.ctx.content;

var midElem = Math.ceil(content.length / 2);
var res;
return content.map((item, i) => {
res = {
block: 'radio',
mods: {view: 'hidden'},
attrs: {id: item.id, name: 'vegetable'}
};

if (midElem === i + 1) {
res.attrs.checked = '';
}
return res;
});
})
);
3 changes: 3 additions & 0 deletions blocks/recipe/__close/recipe__close.bemhtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
block('recipe').elem('close')(
tag()('label')
);
28 changes: 28 additions & 0 deletions blocks/recipe/__close/recipe__close.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.recipe__close {
position: absolute;
right: 10px;
top: 10px;
width: 20px;
height: 20px;
cursor: pointer;
transition: transform .5s ease-in-out;
&:hover {
transform: rotate(180deg) scale(1.5);
}
&::before,
&::after {
content: '';
left: 50%;
top: 50%;
position: absolute;
width: 28px;
height: 3px;
border: 1px solid #747571;
border-radius: 2px;
background-color: #898b86;
transform: translate(-50%, -50%) rotate(45deg);
}
&::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
}
32 changes: 32 additions & 0 deletions blocks/recipe/__ingredients/recipe__ingredients.bemhtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
block('recipe')(
elem('ingredients')(
content()(function() {
var content = this.ctx.content;

return content.map(item => {
return {
elem: 'ingredient',
content: [
{
elem: 'ingredient-name',
content: item.name
},
{
elem:'ingredient-count',
content: `(${item.count})`
}
]
};
});
})
),
elem('ingredient')(
tag()('p')
),
elem('ingredient-name')(
tag()('span')
),
elem('ingredient-count')(
tag()('span')
)
);
17 changes: 17 additions & 0 deletions blocks/recipe/__ingredients/recipe__ingredients.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.recipe {
&__ingredients {
flex: 0 0 100px;
margin-right: 20px;
display: flex;
flex-direction: column;
}
&__ingredient {
margin: 5px 0 0;
&:first-child {
margin-top: 15px;
}
&-name {
font-weight: bold;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.recipe__instruction-footer {
color: #a4a4a4;
font-size: 10px;
margin-top: 15px;
padding-top: 5px;
border-top: 1px solid #000;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
block('recipe')(
elem('instruction-list')(
tag()('ol'),
content()(function() {
var content = this.ctx.content;

return content.map(item => {
return {
elem: 'instruction-item',
content: item.section
};
});
})
),
elem('instruction-item')(
tag()('li')
)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.recipe__instruction-list {
padding: 0;
list-style-position: inside;
margin: 10px 0 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
block('recipe').elem('instruction-title')(
tag()('p')
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.recipe__instruction-title {
margin: 15px 0 0;
color: #ba0000;
}
6 changes: 6 additions & 0 deletions blocks/recipe/__instruction/recipe__instruction.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.recipe__instruction {
flex: 1 1 300px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
30 changes: 30 additions & 0 deletions blocks/recipe/__main/recipe__main.bemtree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
block('recipe').elem('main').content()(function() {
var ctx = this.ctx.data;

return [
{
elem: 'ingredients',
content: ctx.ingredients
},
{
elem: 'instruction',
content: [
{
elem: 'instruction-header',
content: {
elem: 'instruction-title',
content: 'Инструкция'
}
},
{
elem: 'instruction-list',
content: ctx.instructions
},
{
elem: 'instruction-footer',
content: ctx.description
}
]
}
];
});
10 changes: 10 additions & 0 deletions blocks/recipe/__main/recipe__main.deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
({
shouldDeps: [
{ block: 'recipe', elem: 'ingredients' },
{ block: 'recipe', elem: 'instruction' },
{ block: 'recipe', elem: 'instruction-header' },
{ block: 'recipe', elem: 'instruction-title' },
{ block: 'recipe', elem: 'instruction-list' },
{ block: 'recipe', elem: 'instruction-footer' }
]
})
5 changes: 5 additions & 0 deletions blocks/recipe/__main/recipe__main.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.recipe__main {
display: flex;
justify-content: space-between;
font-size: 12px;
}
3 changes: 3 additions & 0 deletions blocks/recipe/__title/recipe__title.bemhtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
block('recipe').elem('title')(
tag()('h2')
);
8 changes: 8 additions & 0 deletions blocks/recipe/__title/recipe__title.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.recipe__title {
font-size: 18px;
font-weight: normal;
margin: 0;
color: #b5b5b5;
padding-bottom: 5px;
border-bottom: 2px solid #b5b5b5;
}
3 changes: 3 additions & 0 deletions blocks/recipe/recipe.bemhtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
block('recipe')(
tag()('article')
);
7 changes: 7 additions & 0 deletions blocks/recipe/recipe.deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
({
shouldDeps: [
{ block: 'recipe', elem: 'close' },
{ block: 'recipe', elem: 'title' },
{ block: 'recipe', elem: 'main' }
]
})
Loading