diff --git a/config/json/projects.json b/config/json/projects.json new file mode 100644 index 0000000..c46f3bb --- /dev/null +++ b/config/json/projects.json @@ -0,0 +1,20 @@ +{ + "cols": 3, + "projects" : [ + { + "title": "Этот сайт", + "description": "Текст", + "image": "images/thissite.png" + }, + { + "title": "ChatManager", + "description": "Плагин для работы с чатом в Minecraft.", + "image": "images/chatmanager.png" + }, + { + "title": "Скоро, совсем скоро, текст", + "description": "Скоро", + "image": "images/soon.jpg" + } + ] +} diff --git a/main.py b/main.py index c6f5592..525067a 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,10 @@ -import flask +from flask import Flask, url_for, render_template import os +import json import numpy.random as gaussian_rnd -app = flask.Flask(__name__, subdomain_matching=True) +app = Flask(__name__, subdomain_matching=True) app.config['SERVER_NAME'] = 'thematdev.local:22837' @@ -22,17 +23,29 @@ def dated_url_for(endpoint, **values): if filename: file_path = os.path.join(app.root_path, endpoint, filename) values['q'] = int(os.stat(file_path).st_mtime) - return flask.url_for(endpoint, **values) + return url_for(endpoint, **values) @app.route('/') def index(): - return flask.render_template('index.html', random_number=generate_iq()) + with open('config/json/projects.json') as file: + data = json.loads(file.read()) + cols = data['cols'] + projects = data['projects'] + length = len(projects) + rows = [] + for i in range(0, length, cols): + row = [] + for j in range(i, min(i + cols, length)): + row.append(projects[j]) + rows.append(row) + + return render_template('index.html', random_number=generate_iq(), rows=rows) @app.route('/', subdomain='tex') def texindex(): - return "Fuck you, leatherman!" + return render_template('texindex.html') def main(): diff --git a/static/assets/css/style.css b/static/assets/css/style.css index 74cdafd..9c60239 100644 --- a/static/assets/css/style.css +++ b/static/assets/css/style.css @@ -21,12 +21,12 @@ body { .pagehead-inner { position: inherit; margin: 0; - width: 456px; - height: 600px; + width: 24%; + height: 55vh; top: 50%; left: 50%; - margin-left: -228px; - margin-top: -300px; + margin-left: -12%; + margin-top: -27vh; display: flex; align-items: center; justify-content: center; @@ -53,6 +53,8 @@ body { background: #222; color: white; border-radius: 15px; + border: none; + outline: none; } .btn-container button:hover { @@ -62,6 +64,11 @@ body { color: green; } +.btn-container button:active { + transform: scale(0.8); + -webkit-transition: transform 0.2s ease-in-out; +} + .mainh { color: white; font-family: "Overpass Mono", monospace; @@ -69,4 +76,64 @@ body { margin: 0; } +.pagebody { + width: 100%; + height: 100vh; + position: relative; + background: #222; + display: flex; + flex-direction: column; + margin: 0; +} + +.pagebody-inner-section { + margin-top: 100px; margin-left: 300px; +} + +.pagebody-inner-section > h1 { + color: white; + font-family: "Overpass Mono", monospace; + font-weight: 700; +} + +.project-container { + position: inherit; + display: flex; + flex-direction: column; +} + +.project-container-row { + display: flex; + position: inherit; + flex-direction: row; +} + +.project-element { + position: inherit; + width: 300px; + margin-right: 70px; + display: flex; + flex-direction: column; +} + +.project-element > h1 { + color: white; + font-family: "Overpass Mono", monospace; + font-weight: 700; + margin: 0; +} + +.project-element > p { + color: white; + font-family: "Overpass Mono", monospace; + font-weight: 400; + margin: 0; +} + +.project-element > img { + background: #222; + margin-top: 20px; + margin-bottom: 20px; +} + . diff --git a/static/assets/images/chatmanager.png b/static/assets/images/chatmanager.png new file mode 100644 index 0000000..c8a49a3 Binary files /dev/null and b/static/assets/images/chatmanager.png differ diff --git a/static/assets/images/soon.jpg b/static/assets/images/soon.jpg new file mode 100644 index 0000000..e664921 Binary files /dev/null and b/static/assets/images/soon.jpg differ diff --git a/static/assets/images/thissite.png b/static/assets/images/thissite.png new file mode 100644 index 0000000..f8f85b4 Binary files /dev/null and b/static/assets/images/thissite.png differ diff --git a/static/js/projects.js b/static/js/projects.js new file mode 100644 index 0000000..44fcf5c --- /dev/null +++ b/static/js/projects.js @@ -0,0 +1,13 @@ +function alignHeadersByHeight(table) { + var maxHeight = 0; + table.querySelectorAll('h1').forEach( + element => maxHeight = Math.max(maxHeight, element.clientHeight) + ) + table.querySelectorAll('h1').forEach( + element => element.style.height = maxHeight + 'px' + ) + console.log(maxHeight); +} + +var table = document.getElementById("pbic"); +alignHeadersByHeight(table); diff --git a/templates/index.html b/templates/index.html index 1aa7ebe..048658a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -24,6 +24,25 @@ +
{{ project.description }}
+