Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NDRR-Dashboard] WIP Card #1

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
@import "lib/govuk-frontend/dist/govuk/base";
@import 'components/colors';
@import 'components/flexbox';
@import 'components/card';

172 changes: 172 additions & 0 deletions app/assets/stylesheets/components/_card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
//THIS IS THE STYLE FOR CARDS:
.card {
flex-grow: 0;
flex-basis: 100%;
margin-bottom: 2em;
}

@media screen and (min-width:600px) and (max-width:900px) {
.card {
flex-basis: 45.99%;
// Every card in the first row needs horizontal margin
&:nth-child(2n-1) {
margin-right: 3%;
}
// Every card in the second row needs horizontal margin
&:nth-child(2n-2) {
margin-left: 3%;
}
}
}

@media screen and (min-width:900px) {
.card {
flex-basis: 31%;

&:nth-child(3n-1) {
margin-left: 3%;
margin-right: 3%;
}
}
}

html[data-useragent*='MSIE 10.0'] .flex-container {
.card {
flex-basis: 31%;
margin: 3%;
}
}

.card {
border: 1px solid $panel-colour;
font-size: 16px;

&.inactive {
color: $secondary-text-colour;
}

.card-heading {
margin-top: 0;
color: #005EA5;
}

.card-body {
border-bottom: 1px solid #dee0e2;
padding: 15px;
background-color: govuk-colour("light-grey");
*:last-child {
margin-bottom: 0;
}

&.active {
background-color: $grey-4;
transition: .1s ease-in-out;

.card-heading a {
color: $link-colour;
margin-top: 0;
&:focus {
color: $black;
outline: 3px solid transparent;
box-shadow: 0 -2px #fd0, 0 4px #0b0c0c;
}
}
}

.detail-large {
color: $secondary-text-colour;
font-size: 32px;
font-weight: 600;
margin-bottom: 8px;
}

.detail {
font-weight: 600;
margin-bottom: 8px;
}

}

.card-action {
border-top: 0;
padding: 12px;

a {
display: inline;
color: $link-colour;
line-height: 1.5em;

&:link,
&:visited {
color: $link-colour;
}

&:hover {
text-decoration: none;
border-bottom: 1px solid $link-colour;
color: #2e8aca;
}

&:focus {
color: $black;
outline: 3px solid transparent;
box-shadow: 0 -2px #fd0, 0 4px #0b0c0c;
}
}

ul {
margin: 0;

li {
margin: 0 0 1em;

&:last-child {
margin-bottom: 0;
}
}
}
}
}

//THIS IS THE TRANSITION ON HOVER FOR CARDS:
.js-enabled .card-body.active:hover {
background-color: #1d70b8;
color: #ffffff;
cursor: pointer;
}

.js-enabled .card-body.active:hover p, .js-enabled .card-body.active:hover h2 {
color: #ffffff;
}

.js-enabled .card-body.active:hover .card-heading a {
color: #ffffff;
}

.js-enabled .card-body.active:hover .status-low {
border: 1px solid #FFFFFF;
color: #FFFFFF;
transition-delay: .25s;
}

.js-enabled .card-body.active:hover .status-med {
background-color: #005EA5;
border: 1px solid #FFFFFF;
color: #FFFFFF;
transition-delay: .25s;
}

.js-enabled .card-body.active:hover .status-high {
border: 1px solid #FFFFFF;
transition-delay: .25s;
}

.js-enabled .card-body.active:hover .detail-large {
color: #FFFFFF;
transition-delay: .25s;
}

.js-enabled .card-body.active a {
display: inline-block;
text-decoration: none;
}
18 changes: 18 additions & 0 deletions app/assets/stylesheets/components/_colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$govuk-blue: #005ea5;
$red: #d4351c;
$grey-1: #6f777b;
$grey-2: #bfc1c3;
$grey-3: #dee0e2;
$grey-4: #f8f8f8;
$light-blue: #2b8cc4;
$link-colour: $govuk-blue;
$link-active-colour: $light-blue;
$link-hover-colour: $light-blue;
$link-visited-colour: #4c2c92;
$yellow: #ffbf47;
$black: #0b0c0c;
$banner-text-colour: #000;
$white: #fff;
$panel-colour: #dee0e2;
$secondary-text-colour: $grey-1;
$page-colour: $white;
11 changes: 11 additions & 0 deletions app/assets/stylesheets/components/_flexbox.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.flex-container {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
justify-content: flex-start;
padding: 0 15px;
}
16 changes: 16 additions & 0 deletions app/uk/gov/hmrc/ndrrprotofrontend/config/AppConfig.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.hmrc.ndrrprotofrontend.config

import javax.inject.{Inject, Singleton}
Expand Down
32 changes: 28 additions & 4 deletions app/uk/gov/hmrc/ndrrprotofrontend/config/ErrorHandler.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
/*
* Copyright 2024 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.hmrc.ndrrprotofrontend.config

import javax.inject.{Inject, Singleton}
import play.api.Logging
import play.api.http.HttpErrorHandler

import play.api.i18n.MessagesApi
import play.api.mvc.RequestHeader
import javax.inject.{Inject, Singleton}
import play.api.i18n.{I18nSupport, Messages, MessagesApi}
import play.api.mvc.{Request, RequestHeader}
import play.twirl.api.Html
import uk.gov.hmrc.ndrrprotofrontend.models.{Link, NavigationBarContent}
import uk.gov.hmrc.play.bootstrap.frontend.http.FrontendErrorHandler
import uk.gov.hmrc.ndrrprotofrontend.views.html.ErrorTemplate

Expand All @@ -17,6 +36,11 @@ class ErrorHandler @Inject()(
)(implicit override val ec: ExecutionContext
) extends FrontendErrorHandler {


private def testNavBar: NavigationBarContent = NavigationBarContent(
AccountHome = Some(Link(url = "/ndrr-proto-frontend/dashboard", Some("nav.home"))),
NavigationButtons = Some(Seq(Link(url = "/ndrr-proto-frontend/dashboard", Some("nav.home")))))

override def standardErrorTemplate(pageTitle: String, heading: String, message: String)(implicit request: RequestHeader): Future[Html] =
Future.successful(errorTemplate(pageTitle, heading, message))
Future.successful(errorTemplate(pageTitle, heading, message, testNavBar))
}
16 changes: 16 additions & 0 deletions app/uk/gov/hmrc/ndrrprotofrontend/config/Module.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.hmrc.ndrrprotofrontend.config

import com.google.inject.AbstractModule
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2024 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.hmrc.ndrrprotofrontend.controllers

import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import uk.gov.hmrc.ndrrprotofrontend.models.{DashboardCard, Link, NavigationBarContent}
import uk.gov.hmrc.ndrrprotofrontend.views.html.ContactDetailsView
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController

import javax.inject.{Inject, Singleton}
import scala.concurrent.Future

@Singleton
class ContactDetailsController @Inject()(
mcc: MessagesControllerComponents,
contactDetailsView: ContactDetailsView)
extends FrontendController(mcc) {

private def testNavBar: NavigationBarContent = NavigationBarContent(
AccountHome = Some(Link(url = "/ndrr-proto-frontend/dashboard", Some("nav.home"))),
NavigationButtons = Some(Seq(Link(url = "/ndrr-proto-frontend/dashboard", Some("nav.home")))))

val show: Action[AnyContent] = Action.async { implicit request =>
Future.successful(
Ok(
contactDetailsView()
)
)
}
}
Loading