Skip to content

Commit

Permalink
Fix unserializable json error in Scenario 2 (#374) and Strong tags sh…
Browse files Browse the repository at this point in the history
…ould render Source Sans Pro bold (#379)

Contains work from #374:
- Change the `AppointmentContent.date` type from a `Date` object to a `string` representation of the date
As well as work from #379: 
- Use Google fonts for Source Sans Pro: bold, italic, bolditalic
- Remove local bold ttf file
  • Loading branch information
rocketnova authored Aug 19, 2021
2 parents 012d125 + 00ae365 commit 9a9274d
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 22 deletions.
8 changes: 6 additions & 2 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<link href="https://fonts.googleapis.com/css?family=Source Sans Pro" rel="stylesheet" />
<link href="/claimstatus/source-sans-pro-bold.ttf" rel="stylesheet" type="text/css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet"
/>
8 changes: 6 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ export default function Home({
<Head>
<title>{t('title')}</title>
<link rel="icon" href="/claimstatus/favicon.ico" />
<link href="https://fonts.googleapis.com/css?family=Source Sans Pro" rel="stylesheet" />
<link href="/claimstatus/source-sans-pro-bold.ttf" rel="stylesheet" type="text/css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true" />
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet"
/>
</Head>
<Header userArrivedFromUioMobile={userArrivedFromUioMobile} />
{mainComponent}
Expand Down
Binary file removed public/source-sans-pro-bold.ttf
Binary file not shown.
3 changes: 1 addition & 2 deletions stories/Appointment.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default {
} as Meta

interface StoryAppointmentProps extends AppointmentProps {
date: Date
start?: number
end?: number
}
Expand All @@ -64,5 +63,5 @@ const Template: Story<StoryAppointmentProps> = ({ ...args }) => {

export const Appointment = Template.bind({})
Appointment.args = {
date: new Date(),
date: new Date().toJSON(),
}
2 changes: 1 addition & 1 deletion stories/ClaimSummary.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ ClaimSummary.args = {
},
],
appointment: {
date: new Date(),
date: new Date().toJSON(),
},
}
17 changes: 8 additions & 9 deletions styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ body {
color: #333333;
line-height: 22.4px;

b, strong {
font-family: 'Source Sans Pro Bold', arial;
b,
strong {
font-weight: 700;
}

h3 {
Expand Down Expand Up @@ -109,7 +110,7 @@ body {
}

.claim-details-box {
padding: 0 1.5rem 1.0rem 1.5rem;
padding: 0 1.5rem 1rem 1.5rem;
border: 4px solid #f0f0f0;
}

Expand All @@ -134,21 +135,21 @@ body {
padding-left: 1rem;
margin-top: 0.5rem;
margin-left: 0.5rem;
list-style: none
list-style: none;
}

//this styles our bullets into fancy small dots with a consistent color
//pulled from https://www.w3.org/Style/Examples/007/color-bullets.en.html
li::before {
content: "";
content: '';
color: black;
display: inline-block;
width: 1em;
margin-left: -1em
margin-left: -1em;
}

li {
margin-bottom:0.5rem;
margin-bottom: 0.5rem;
}

.sub-bullets {
Expand Down Expand Up @@ -182,7 +183,6 @@ body {
.claim-section {
margin-top: 2rem;
}

}
}

Expand All @@ -191,7 +191,6 @@ body {
position: relative;
margin-top: 10px !important;


-webkit-animation-duration: 1.3s;
-webkit-animation-fill-mode: forwards;
-webkit-animation-iteration-count: infinite;
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/getClaimStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('An appointment is', () => {

it('returned with a time slot if there is a time slot value', () => {
const pendingDetermination = getPendingDeterminationWithScheduleDate(0)
const expectedDate = parseApiGatewayDate(formatFromApiGateway(0))
const expectedDate = parseApiGatewayDate(formatFromApiGateway(0)).toJSON()

pendingDetermination.timeSlotDesc = '10-12'
const expectedTimeSlot = {
Expand All @@ -40,7 +40,7 @@ describe('An appointment is', () => {

it('returned with no time slot if there is no time slot value', () => {
const pendingDetermination = getPendingDeterminationWithScheduleDate(0)
const expectedDate = parseApiGatewayDate(formatFromApiGateway(0))
const expectedDate = parseApiGatewayDate(formatFromApiGateway(0)).toJSON()
const appointment = buildAppointment(ScenarioType.Scenario2, pendingDetermination)
expect(appointment.date).toStrictEqual(expectedDate)
expect(appointment.timeSlot).toBe(undefined)
Expand Down
2 changes: 1 addition & 1 deletion types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface TimeSlot {
}

export interface AppointmentContent {
date: Date
date: string
timeSlot?: TimeSlot
}

Expand Down
4 changes: 2 additions & 2 deletions utils/formatDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ export function convertStringToLocale(localeString: string): Locale {
/**
* Format appointment.
*/
export function formatAppointmentDate(date: Date, localeString: string): string {
export function formatAppointmentDate(dateString: string, localeString: string): string {
const dateFormat = 'EEEE, LLLL d, yyyy'
const convertedDate = utcToZonedTime(date, pacificTimeZone)
const convertedDate = utcToZonedTime(dateString, pacificTimeZone)
const formattedDate = format(convertedDate, dateFormat, {
locale: convertStringToLocale(localeString),
timeZone: pacificTimeZone,
Expand Down
2 changes: 1 addition & 1 deletion utils/getClaimStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function buildAppointment(
if (scenarioType === ScenarioType.Scenario2 && pendingDetermination) {
const parsedDate = parseApiGatewayDate(pendingDetermination.scheduleDate)
const appointment: AppointmentContent = {
date: parsedDate,
date: parsedDate.toJSON(),
}

const timeSlot = parseTimeSlot(pendingDetermination.timeSlotDesc)
Expand Down

0 comments on commit 9a9274d

Please sign in to comment.