Commit af95c01b authored by Cliff Li's avatar Cliff Li
Browse files

Setup less and basic frontpage structure

parent f551c083
import m from 'mithril';
import * as events from '../models/events';
import './styles/frontpage.less';
const date = `${new Date().toISOString().split('.')[0]}Z`;
const renderCards = item => m('div', { class: 'frontpage-card' }, item);
const renderHotCards = (item, index) => {
if (index === 0) return m('div', { class: 'hot-first-card' }, item);
return m('div', { class: 'hot-card' }, item);
};
export default class Frontpage {
static view() {
return m('div', 'example AMIV content');
constructor() {
events.load({
where: {
time_advertising_start: { $lte: date },
time_advertising_end: { $gte: date },
show_website: true,
},
sort: ['-priority', 'time_advertising_start'],
});
// this.events = events.getList().slice(0, 3);
// MOCKDATA
this.hot = ['super hot', 'also pretty hot', 'kinda hot'];
this.events = ['cool event', 'another event', 'sorta cool', 'something'];
this.jobs = ['google', 'less than google', 'abb', 'accenture'];
}
static oninit() {
console.log('init');
}
view() {
return m('div', { class: 'container' }, [
m('div', { class: 'hot-row' }, this.hot.map((item, index) => renderHotCards(item, index))),
m('div', { class: 'frontpage-row' }, this.events.map(item => renderCards(item))),
m('div', { class: 'frontpage-row' }, this.jobs.map(item => renderCards(item))),
]);
}
}
div {
border: solid 1px black;
}
\ No newline at end of file
@import 'base';
div .hot-row {
background-color: aqua;
}
\ No newline at end of file
......@@ -23,10 +23,12 @@ const config = {
{
test: /\.js$/, // Check for all js files
exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: { presets: ['env'] },
}],
use: [
{
loader: 'babel-loader',
options: { presets: ['env'] },
},
],
},
{
test: /src\/views\/companies\/markdown\/[a-zA-Z\d-]{3,}\.md$/, // Check for all .md files in /companies/markdown
......@@ -44,6 +46,20 @@ const config = {
},
],
},
{
test: /\.less$/,
use: [
{
loader: 'style-loader', // creates style nodes from JS strings
},
{
loader: 'css-loader', // translates CSS into CommonJS
},
{
loader: 'less-loader', // compiles Less to CSS
},
],
},
],
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment