Skip to content

Commit

Permalink
Revert "VACMS-18457 Implement action links on Event CTAs (#850)"
Browse files Browse the repository at this point in the history
This reverts commit 510b90d.
  • Loading branch information
timcosgrove authored Dec 19, 2024
1 parent 510b90d commit 45fb1f9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 48 deletions.
35 changes: 17 additions & 18 deletions additional.d.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
/// <reference types="react-scripts" />

declare module 'nock'
declare module 'test-utils'
declare module '@testing-library/react'
declare module '@department-of-veterans-affairs/component-library'
declare module '@department-of-veterans-affairs/component-library/Table'
declare module '@department-of-veterans-affairs/component-library/LoadingIndicator'
declare module '@department-of-veterans-affairs/component-library/AlertBox'
declare module '@department-of-veterans-affairs/component-library/Banner'
declare module '@department-of-veterans-affairs/component-library/Breadcrumbs'
declare module '@department-of-veterans-affairs/component-library/dist/react-bindings'
declare module '@department-of-veterans-affairs/component-library/DropDownPanel'
declare module '@department-of-veterans-affairs/component-library/LoadingIndicator'
declare module '@department-of-veterans-affairs/component-library/Breadcrumbs'
declare module '@department-of-veterans-affairs/component-library/Banner'
declare module '@department-of-veterans-affairs/component-library/TextInput'
declare module '@department-of-veterans-affairs/component-library/TextArea'
declare module '@department-of-veterans-affairs/component-library/Modal'
declare module '@department-of-veterans-affairs/component-library/Pagination'
declare module '@department-of-veterans-affairs/component-library/ProgressButton'
declare module '@department-of-veterans-affairs/component-library/PromoBanner'
declare module '@department-of-veterans-affairs/component-library/Table'
declare module '@department-of-veterans-affairs/component-library/TextArea'
declare module '@department-of-veterans-affairs/component-library/TextInput'
declare module '@testing-library/react'
declare module 'debug'
declare module '@department-of-veterans-affairs/component-library/dist/react-bindings'
declare module 'mq-polyfill'
declare module 'nock'
declare module 'test-utils'
declare module 'debug'

declare namespace JSX {
interface IntrinsicElements {
'va-accordion-item'
'va-accordion'
'va-alert'
'va-back-to-top'
'va-breadcrumbs'
'va-button'
'va-icon'
'va-link'
'va-link-action'
'va-icon'
'va-button'
'va-breadcrumbs'
'va-accordion'
'va-accordion-item'
'va-on-this-page'
'va-back-to-top'
}
}
7 changes: 0 additions & 7 deletions src/lib/utils/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import { formatEventCTA, createMailToLink } from './events'

describe('formatEventCTA', () => {
describe('formatEventCTA', () => {
it('should format "rsvp" as "RSVP"', () => {
const input = 'rsvp'
const expected = 'RSVP'
const result = formatEventCTA(input)
expect(result).toBe(expected)
})

it('should format "register_now" as "Register now"', () => {
const input = 'register_now'
const expected = 'Register now'
Expand Down
4 changes: 0 additions & 4 deletions src/lib/utils/events.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { deriveFormattedTimestamp } from './date'

export function formatEventCTA(input: string): string {
if (input.toLowerCase() === 'rsvp') {
return 'RSVP'
}

const words: string[] = input.split('_')

const formattedString: string = words
Expand Down
43 changes: 24 additions & 19 deletions src/templates/layouts/event/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ export const Event = ({
.filter(Boolean)
.join(', ')

const eventCTAText = formatEventCTA(eventCTA)

return (
<div className="va-l-detail-page va-facility-page">
<div className="usa-grid usa-grid-full">
Expand Down Expand Up @@ -230,26 +228,33 @@ export const Event = ({
</p>
) : (
<>
{link && eventCTAText && (
<va-link-action
class="vads-u-display--block"
href={link?.uri}
text={eventCTAText}
/>
{link && (
<p className="vads-u-margin--0">
<a className="vads-c-action-link--green" href={link?.uri}>
{eventCTA && eventCTA != 'more_details'
? eventCTA.toLowerCase() === 'rsvp'
? eventCTA.toUpperCase()
: eventCTA.charAt(0).toUpperCase() + eventCTA.slice(1)
: 'More details'}
</a>
</p>
)}
{howToSignUp === 'email' && (
<>
{mostRecentDate && eventCTAText && (
<va-link-action
class="vads-u-display--block"
href={createMailToLink(
emailCTA,
title,
mostRecentDate,
link?.uri
)}
text={eventCTAText}
/>
{mostRecentDate && (
<p className="vads-u-margin--0">
<a
className="vads-c-action-link--green"
href={createMailToLink(
emailCTA,
title,
mostRecentDate,
link?.uri
)}
>
{eventCTA && formatEventCTA(eventCTA)}
</a>
</p>
)}
</>
)}
Expand Down

0 comments on commit 45fb1f9

Please sign in to comment.