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

Revert "VACMS-18457 Implement action links on Event CTAs" #851

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading