Browse Source

Update look and feel

- Add new email button
- Update styles and alignments
Alexey Edelev 5 years ago
parent
commit
63d265da61
5 changed files with 139 additions and 13 deletions
  1. 111 5
      css/styles.css
  2. 4 3
      main.go
  3. 5 0
      templater.go
  4. 15 1
      templates/index.html
  5. 4 4
      templates/maillist.html

+ 111 - 5
css/styles.css

@@ -1,10 +1,21 @@
-.mailList {
-    width: 100%;
-    table-layout: fixed;
+* {
     font-family: 'Titillium Web';
+}
+
+body {
+    background-color: white;
+}
+
+table {
     border-collapse: collapse;
     border-spacing: 0;
-    box-shadow: 0pt 3pt 6pt 0pt rgba(0,0,0,0.5);
+}
+
+table.mailList {
+    width: 100%;
+    table-layout: fixed;
+    border-radius: 2pt;
+    overflow: hidden;
 }
 
 .mailList td {
@@ -15,9 +26,14 @@
     border-bottom: 0;
 }
 
-tr {
+.mailList tr {
     background-color: aliceblue;
     border-bottom: 1px solid rgb(169, 198, 223);
+    cursor: pointer;
+}
+
+.mailList tr:hover {
+    background-color: rgb(229, 239, 248);
 }
 
 td.fromCol {
@@ -40,3 +56,93 @@ td.dateCol {
     white-space: nowrap;
 }
 
+
+.btn {
+    position: relative;
+
+    display: block;
+    margin: 10pt auto;
+    padding:8pt;
+
+    overflow: hidden;
+
+    border-width: 0;
+    outline: none;
+    border-radius: 2pt;
+    box-shadow: 0 1pt 4pt rgba(0, 0, 0, .6);
+
+    background-color: #2ecc71;
+    color: #ecf0f1;
+
+    font-size: 12pt;
+    font-weight: bold;
+    transition: background-color .3s;
+}
+
+.btn:hover, .btn:focus {
+    background-color: #27ae60;
+}
+
+.btn > * {
+    position: relative;
+}
+
+.btn span {
+    display: block;
+    padding: 12px 24px;
+}
+
+.btn:before {
+    content: "";
+
+    position: absolute;
+    top: 50%;
+    left: 50%;
+
+    display: block;
+    width: 0;
+    padding-top: 0;
+
+    border-radius: 100%;
+
+    background-color: rgba(236, 240, 241, .3);
+
+    -webkit-transform: translate(-50%, -50%);
+    -moz-transform: translate(-50%, -50%);
+    -ms-transform: translate(-50%, -50%);
+    -o-transform: translate(-50%, -50%);
+    transform: translate(-50%, -50%);
+}
+
+.btn:active:before {
+    width: 120%;
+    padding-top: 120%;
+
+    transition: width .2s ease-out, padding-top .2s ease-out;
+}
+
+.btn.orange {
+    background-color: #e67e22;
+}
+
+.btn.orange:hover, .btn.orange:focus {
+    background-color: #d35400;
+}
+
+.btn.red {
+    background-color: #e74c3c;
+}
+
+.btn.red:hover, .btn.red:focus {
+    background-color: #c0392b;
+}
+
+.materialLevel1 {
+    box-shadow: 0 1pt 3pt rgba(0, 0, 0, .6);
+
+}
+
+.materialLevel2 {
+    box-shadow: 0 1pt 4pt rgba(0, 0, 0, .6);
+
+}

+ 4 - 3
main.go

@@ -244,9 +244,10 @@ func (e *GofixEngine) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 				state = StateHeaderScan
 			}
 
-			content := template.HTML(e.templater.ExecuteMailList(emails))
-
-			fmt.Fprint(w, e.templater.ExecuteIndex(content))
+			fmt.Fprint(w, e.templater.ExecuteIndex(&Index{
+				MailList: template.HTML(e.templater.ExecuteMailList(emails)),
+				Folders:  "Folders",
+			}))
 		}
 	}
 }

+ 5 - 0
templater.go

@@ -42,6 +42,11 @@ type Templater struct {
 	mailListTemplate *template.Template
 }
 
+type Index struct {
+	Folders  template.HTML
+	MailList template.HTML
+}
+
 func NewTemplater(templatesPath string) (t *Templater) {
 	t = nil
 	index, err := parseTemplate(templatesPath + "/" + IndexTemplateName)

+ 15 - 1
templates/index.html

@@ -6,6 +6,20 @@
         <link type="text/css" href="css/styles.css" rel="stylesheet">
     </head>
     <body>
-        {{.}}
+        <table style="width: 100%;">
+            <tr>
+                <td style="width: 150pt; vertical-align:top">
+                    <div style="display: inline-block; overflow-y: auto; padding: 10pt; ">
+                        <button class="btn orange materialLevel1">New email</button>
+                        {{.Folders}}
+                    </div>
+                </td>
+                <td>
+                    <div style="display: inline-block; overflow-y: auto; padding: 10pt;">
+                        {{.MailList}}
+                    </div>
+                </td>
+            </tr>
+        </div>
     </body>
 </html>

+ 4 - 4
templates/maillist.html

@@ -1,8 +1,8 @@
-<table class="mailList">
+<table class="mailList materialLevel1">
     <tbody>
         {{range .}}
-        <tr>
-            <td class="fromCol">{{.Header.From}}</td>
+        <tr onclick="window.location='#';">
+            <td class="fromCol">{{.Header.From}}</a></td>
             <td class="subjCol">{{.Header.Subject}}</td>
             <td class="dateCol">{{.Header.Date}}</td>
         </tr>
@@ -10,4 +10,4 @@
         <tr><td><b>Mail folder is empty</b></td>></tr>
         {{end}}
     </tbody>
-</table>
+</table>