1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

ui: Stop using element IDs for styling

This commit is contained in:
James Hillyerd
2018-11-25 19:52:28 -08:00
parent 0cf97f5c58
commit 22884378f3
6 changed files with 45 additions and 45 deletions

View File

@@ -55,7 +55,7 @@ view : Session -> Model -> { title : String, content : Html Msg }
view session model = view session model =
{ title = "Inbucket" { title = "Inbucket"
, content = , content =
div [ id "page" ] div [ class "page" ]
[ Html.node "rendered-html" [ Html.node "rendered-html"
[ class "greeting" [ class "greeting"
, property "content" (Encode.string model.greeting) , property "content" (Encode.string model.greeting)

View File

@@ -474,10 +474,10 @@ view : Session -> Model -> { title : String, content : Html Msg }
view session model = view session model =
{ title = model.mailboxName ++ " - Inbucket" { title = model.mailboxName ++ " - Inbucket"
, content = , content =
div [ id "page", class "mailbox" ] div [ class "page mailbox" ]
[ viewMessageList session model [ viewMessageList session model
, main_ , main_
[ id "message" ] [ class "message" ]
[ case model.state of [ case model.state of
ShowingList _ NoMessage -> ShowingList _ NoMessage ->
text text
@@ -500,7 +500,7 @@ view session model =
viewMessageList : Session -> Model -> Html Msg viewMessageList : Session -> Model -> Html Msg
viewMessageList session model = viewMessageList session model =
aside [ id "message-list" ] aside [ class "message-list" ]
[ div [] [ div []
[ input [ input
[ type_ "search" [ type_ "search"
@@ -554,7 +554,7 @@ viewMessage zone message bodyMode =
[ href sourceUrl, target "_blank" ] [ href sourceUrl, target "_blank" ]
[ button [] [ text "Source" ] ] [ button [] [ text "Source" ] ]
] ]
, dl [ id "message-header" ] , dl [ class "message-header" ]
[ dt [] [ text "From:" ] [ dt [] [ text "From:" ]
, dd [] [ text message.from ] , dd [] [ text message.from ]
, dt [] [ text "To:" ] , dt [] [ text "To:" ]

View File

@@ -86,7 +86,7 @@ view : Session -> Model -> { title : String, content : Html Msg }
view session model = view session model =
{ title = "Inbucket Monitor" { title = "Inbucket Monitor"
, content = , content =
div [ id "page" ] div [ class "page" ]
[ h1 [] [ text "Monitor" ] [ h1 [] [ text "Monitor" ]
, p [] , p []
[ text "Messages will be listed here shortly after delivery. " [ text "Messages will be listed here shortly after delivery. "
@@ -100,7 +100,7 @@ view session model =
) )
] ]
] ]
, table [ id "monitor" ] , table [ class "monitor" ]
[ thead [] [ thead []
[ th [] [ text "Date" ] [ th [] [ text "Date" ]
, th [ class "desktop" ] [ text "From" ] , th [ class "desktop" ] [ text "From" ]

View File

@@ -219,7 +219,7 @@ view : Session -> Model -> { title : String, content : Html Msg }
view session model = view session model =
{ title = "Inbucket Status" { title = "Inbucket Status"
, content = , content =
div [ id "page" ] div [ class "page" ]
[ h1 [] [ text "Status" ] [ h1 [] [ text "Status" ]
, case model.metrics of , case model.metrics of
Nothing -> Nothing ->

View File

@@ -39,15 +39,15 @@ type alias FrameControls msg =
frame : FrameControls msg -> Session -> ActivePage -> Html msg -> Html msg frame : FrameControls msg -> Session -> ActivePage -> Html msg -> Html msg
frame controls session page content = frame controls session page content =
div [ id "app" ] div [ class "app" ]
[ header [] [ header []
[ ul [ class "navbar", attribute "role" "navigation" ] [ ul [ class "navbar", attribute "role" "navigation" ]
[ li [ id "navbar-brand" ] [ li [ class "navbar-brand" ]
[ a [ Route.href Route.Home ] [ text "@ inbucket" ] ] [ a [ Route.href Route.Home ] [ text "@ inbucket" ] ]
, navbarLink page Route.Monitor [ text "Monitor" ] , navbarLink page Route.Monitor [ text "Monitor" ]
, navbarLink page Route.Status [ text "Status" ] , navbarLink page Route.Status [ text "Status" ]
, navbarRecent page controls , navbarRecent page controls
, li [ id "navbar-mailbox" ] , li [ class "navbar-mailbox" ]
[ form [ Events.onSubmit (controls.viewMailbox controls.mailboxValue) ] [ form [ Events.onSubmit (controls.viewMailbox controls.mailboxValue) ]
[ input [ input
[ type_ "text" [ type_ "text"
@@ -61,10 +61,10 @@ frame controls session page content =
] ]
, errorFlash controls session.flash , errorFlash controls session.flash
] ]
, div [ id "navbg" ] [ text "" ] , div [ class "navbar-bg" ] [ text "" ]
, content , content
, footer [] , footer []
[ div [ id "footer" ] [ div [ class "footer" ]
[ externalLink "https://www.inbucket.org" "Inbucket" [ externalLink "https://www.inbucket.org" "Inbucket"
, text " is an open source projected hosted at " , text " is an open source projected hosted at "
, externalLink "https://github.com/jhillyerd/inbucket" "GitHub" , externalLink "https://github.com/jhillyerd/inbucket" "GitHub"
@@ -128,7 +128,7 @@ navbarRecent page controls =
a [ Route.href (Route.Mailbox mailbox) ] [ text mailbox ] a [ Route.href (Route.Mailbox mailbox) ] [ text mailbox ]
in in
li li
[ id "navbar-recent" [ class "navbar-recent"
, classList [ ( "navbar-dropdown", True ), ( "navbar-active", active ) ] , classList [ ( "navbar-dropdown", True ), ( "navbar-active", active ) ]
] ]
[ span [] [ text title ] [ span [] [ text title ]

View File

@@ -84,7 +84,7 @@ a.button {
/** APP */ /** APP */
#app { .app {
display: grid; display: grid;
justify-content: center; justify-content: center;
grid-gap: 20px; grid-gap: 20px;
@@ -96,7 +96,7 @@ a.button {
} }
@media (max-width: 999px) { @media (max-width: 999px) {
#app { .app {
grid-template: grid-template:
"head head head" auto "head head head" auto
"lpad page rpad" 1fr "lpad page rpad" 1fr
@@ -113,7 +113,7 @@ header {
grid-area: head; grid-area: head;
} }
#page { .page {
grid-area: page; grid-area: page;
} }
@@ -124,7 +124,7 @@ footer {
grid-area: foot; grid-area: foot;
} }
#footer { .footer {
margin: 10px auto; margin: 10px auto;
} }
@@ -164,7 +164,7 @@ h1 {
/** NAV BAR */ /** NAV BAR */
.navbar, .navbar,
#navbg { .navbar-bg {
height: 50px; height: 50px;
} }
@@ -176,6 +176,15 @@ h1 {
text-shadow: 0 -1px 0 rgba(0,0,0,0.2); text-shadow: 0 -1px 0 rgba(0,0,0,0.2);
} }
.navbar-bg {
background-color: #222;
background-image: linear-gradient(to bottom, #3c3c3c 0, #222 100%);
grid-column: 1 / 4;
grid-row: 1;
width: 100%;
z-index: -1;
}
.navbar li { .navbar li {
color: #9d9d9d; color: #9d9d9d;
} }
@@ -198,20 +207,20 @@ li.navbar-active span,
color: #ffffff; color: #ffffff;
} }
#navbar-brand { .navbar-brand {
font-size: 18px; font-size: 18px;
margin-left: -15px; margin-left: -15px;
} }
#navbar-recent { .navbar-recent {
margin: 0 auto; margin: 0 auto;
} }
#navbar-mailbox { .navbar-mailbox {
padding: 8px 0 !important; padding: 8px 0 !important;
} }
#navbar-mailbox input { .navbar-mailbox input {
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 4px; border-radius: 4px;
padding: 5px 10px; padding: 5px 10px;
@@ -245,15 +254,6 @@ li.navbar-active span,
background-color: var(--selected-color); background-color: var(--selected-color);
} }
#navbg {
background-color: #222;
background-image: linear-gradient(to bottom, #3c3c3c 0, #222 100%);
grid-column: 1 / 4;
grid-row: 1;
width: 100%;
z-index: -1;
}
/** BUTTONS */ /** BUTTONS */
.button-bar button { .button-bar button {
@@ -302,7 +302,7 @@ li.navbar-active span,
} }
} }
#message-list { .message-list {
grid-area: list; grid-area: list;
} }
@@ -339,11 +339,11 @@ li.navbar-active span,
/** MESSAGE */ /** MESSAGE */
#message { .message {
grid-area: mesg; grid-area: mesg;
} }
#message-header { .message-header {
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 4px; border-radius: 4px;
box-shadow: 0 1px 2px rgba(0,0,0,.05); box-shadow: 0 1px 2px rgba(0,0,0,.05);
@@ -351,28 +351,28 @@ li.navbar-active span,
margin: 10px 0; margin: 10px 0;
} }
#message-header dt { .message-header dt {
color: var(--low-color); color: var(--low-color);
font-weight: bold; font-weight: bold;
} }
#message-header dd { .message-header dd {
color: var(--low-color); color: var(--low-color);
padding-left: 10px; padding-left: 10px;
} }
@media (min-width: 1000px) { @media (min-width: 1000px) {
#message-header { .message-header {
display: grid; display: grid;
grid-template: auto / 5em 1fr; grid-template: auto / 5em 1fr;
} }
#message-header dt { .message-header dt {
grid-column: 1; grid-column: 1;
text-align: right; text-align: right;
} }
#message-header dd { .message-header dd {
grid-column: 2; grid-column: 2;
} }
} }
@@ -427,7 +427,7 @@ nav.tab-bar a.active:hover {
} }
.metric-panel h2 { .metric-panel h2 {
background-image: linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%); background-image: linear-gradient(to bottom, #f5f5f5 0, #e8e8e8 100%);
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
padding: 10px; padding: 10px;
@@ -458,24 +458,24 @@ nav.tab-bar a.active:hover {
/** MONITOR **/ /** MONITOR **/
#monitor { .monitor {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
} }
#monitor th { .monitor th {
border-bottom: 2px solid var(--border-color); border-bottom: 2px solid var(--border-color);
text-align: left; text-align: left;
padding: 5px; padding: 5px;
} }
#monitor td { .monitor td {
border-bottom: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
font-size: 12px; font-size: 12px;
padding: 5px; padding: 5px;
} }
#monitor tr:hover { .monitor tr:hover {
background-color: var(--selected-color); background-color: var(--selected-color);
cursor: pointer; cursor: pointer;
} }