diff --git a/components/GoldSponsors.js b/components/GoldSponsors.js deleted file mode 100644 index a958de28fd5b..000000000000 --- a/components/GoldSponsors.js +++ /dev/null @@ -1,21 +0,0 @@ -export default function GoldSponsors({ className = '', showSupportBanner = true }){ - return( -
-
- - Red Hat - -
-
- ) - -} diff --git a/components/MDX.js b/components/MDX.js index b35c1a2afba3..168e6c8dfb75 100644 --- a/components/MDX.js +++ b/components/MDX.js @@ -10,7 +10,7 @@ import ChapterSuggestions from '../components/buttons/ChapterSuggestions' import CodeBlock from '../components/editor/CodeBlock' import Remember from '../components/Remember' import Warning from '../components/Warning' -import Sponsors from '../components/Sponsors' +import Sponsors from "./sponsors/Sponsors"; import Caption from '../components/Caption' import Row from '../components/layout/Row' import Column from '../components/layout/Column' diff --git a/components/SilverSponsors.js b/components/SilverSponsors.js deleted file mode 100644 index 8159d3116a74..000000000000 --- a/components/SilverSponsors.js +++ /dev/null @@ -1,21 +0,0 @@ -export default function SilverSponsors({ className = '', showSupportBanner = true }){ - return( -
-
- - Bump.sh - -
-
- ) - -} diff --git a/components/Sponsors.js b/components/Sponsors.js deleted file mode 100644 index cd6c16079958..000000000000 --- a/components/Sponsors.js +++ /dev/null @@ -1,78 +0,0 @@ -export default function Sponsors({ className = '', showSupportBanner = true }) { - return ( -
- - {showSupportBanner && ( -
- Want to become a sponsor?{' '} - - Support us! - -
- )} -
- ); -} diff --git a/components/sponsors/GoldSponsors.js b/components/sponsors/GoldSponsors.js new file mode 100644 index 000000000000..d8d73bc34bde --- /dev/null +++ b/components/sponsors/GoldSponsors.js @@ -0,0 +1,27 @@ +import {goldSponsors} from './GoldSponsorsList'; +export default function GoldSponsors({ className = '', showSupportBanner = true }) { + return ( +
+
+ {goldSponsors.map((sponsor, index) => ( + + {sponsor.name} + + ))} +
+
+ ); + } + diff --git a/components/sponsors/GoldSponsorsList.js b/components/sponsors/GoldSponsorsList.js new file mode 100644 index 000000000000..bf037925cc84 --- /dev/null +++ b/components/sponsors/GoldSponsorsList.js @@ -0,0 +1,8 @@ +export const goldSponsors = [ + { + name: 'Red Hat', + imageSrc: '/img/sponsors/redhat.svg', + website: 'https://www.redhat.com/', + }, + +]; \ No newline at end of file diff --git a/components/sponsors/SilverSponsors.js b/components/sponsors/SilverSponsors.js new file mode 100644 index 000000000000..51aff2d17f7d --- /dev/null +++ b/components/sponsors/SilverSponsors.js @@ -0,0 +1,27 @@ +import { Silversponsors } from "./SilverSponsorsList"; +export default function SilverSponsors({ className = '', showSupportBanner = true }) { + return ( +
+
+ {Silversponsors.map((sponsor, index) => ( + + {sponsor.name} + + ))} +
+
+ ); + } + \ No newline at end of file diff --git a/components/sponsors/SilverSponsorsList.js b/components/sponsors/SilverSponsorsList.js new file mode 100644 index 000000000000..ced665900324 --- /dev/null +++ b/components/sponsors/SilverSponsorsList.js @@ -0,0 +1,8 @@ +export const Silversponsors = [ + { + name: 'Bump.sh', + url: 'https://bump.sh/asyncapi?utm_source=asyncapi&utm_medium=referral&utm_campaign=sponsor', + image: '/img/sponsors/bumpsh.svg' + }, + + ]; \ No newline at end of file diff --git a/components/sponsors/Sponsors.js b/components/sponsors/Sponsors.js new file mode 100644 index 000000000000..5777bcea2748 --- /dev/null +++ b/components/sponsors/Sponsors.js @@ -0,0 +1,44 @@ +import { sponsors } from "./SponsorsList"; +export default function Sponsors({ className = '', showSupportBanner = true }) { +return ( +
+ + {showSupportBanner && ( +
+ Want to become a sponsor?{' '} + + Support us! + +
+ )} +
+ ); +} diff --git a/components/sponsors/SponsorsList.js b/components/sponsors/SponsorsList.js new file mode 100644 index 000000000000..9170aad48ba2 --- /dev/null +++ b/components/sponsors/SponsorsList.js @@ -0,0 +1,30 @@ +export const sponsors = [ + { + name: 'IBM', + link: 'https://www.ibm.com', + imageSrc: '/img/sponsors/ibm.png', + altText: 'IBM', + imageClass: 'inline-block px-4 sm:h-14', + }, + { + name: 'IQVIA Technologies', + link: 'https://www.iqvia.com', + imageSrc: '/img/sponsors/iqvia.png', + altText: 'IQVIA Technologies', + imageClass: 'inline-block px-4 sm:h-10', + }, + { + name: 'Postman', + link: 'https://www.postman.com', + imageSrc: '/img/sponsors/postman.png', + altText: 'Postman', + imageClass: 'inline-block px-2 sm:h-18 flex-shrink-0', + }, + { + name: 'Solace', + link: 'https://www.solace.com', + imageSrc: '/img/sponsors/solace.png', + altText: 'Solace', + imageClass: 'inline-block px-4 sm:h-10', + }, + ]; \ No newline at end of file diff --git a/cypress/test/sponsors/GoldSponsors.cy.js b/cypress/test/sponsors/GoldSponsors.cy.js new file mode 100644 index 000000000000..bd2cebeaad8c --- /dev/null +++ b/cypress/test/sponsors/GoldSponsors.cy.js @@ -0,0 +1,22 @@ +import {mount} from 'cypress/react' +import GoldSponsors from '../../../components/sponsors/GoldSponsors'; +import { goldSponsors } from '../../../components/sponsors/GoldSponsorsList'; +describe('GoldSponsors Component', () => { + beforeEach(() => { + mount(); + }); + + it('renders the gold sponsors', () => { + cy.get('.flex-wrap') + .find('[data-testid="GoldSponsors-link"]') + .should('have.length', goldSponsors.length) + .each(($sponsor, index) => { + const sponsor = goldSponsors[index]; + cy.wrap($sponsor) + .should('have.attr', 'href', sponsor.website) + .find('[data-testid="GoldSponsors-img"]') + .should('have.attr', 'src', sponsor.imageSrc) + .should('have.attr', 'alt', sponsor.name); + }); + }); +}); diff --git a/cypress/test/sponsors/SilverSponsors.cy.js b/cypress/test/sponsors/SilverSponsors.cy.js new file mode 100644 index 000000000000..f5b050db79e0 --- /dev/null +++ b/cypress/test/sponsors/SilverSponsors.cy.js @@ -0,0 +1,18 @@ +import { mount } from 'cypress/react'; +import SilverSponsors from '../../../components/sponsors/SilverSponsors'; +import { Silversponsors } from '../../../components/sponsors/SilverSponsorsList'; + +describe('SilverSponsors', () => { + it('renders silver sponsors correctly', () => { + mount( + + ); + Silversponsors.forEach((sponsor, index) => { + cy.get('[data-testid="SilverSponsors-link"]').eq(index) + .should('have.attr', 'href', sponsor.url) + .find('[data-testid="SilverSponsors-img"]') + .should('have.attr', 'src', sponsor.image) + .should('have.attr', 'alt', sponsor.name); + }); + }); +}); diff --git a/cypress/test/sponsors/Sponsors.cy.js b/cypress/test/sponsors/Sponsors.cy.js new file mode 100644 index 000000000000..feb5e16e021b --- /dev/null +++ b/cypress/test/sponsors/Sponsors.cy.js @@ -0,0 +1,36 @@ +import { mount } from 'cypress/react'; +import Sponsors from '../../../components/sponsors/Sponsors'; +import { sponsors } from '../../../components/sponsors/SponsorsList'; + +describe('Sponsors Component', () => { + it('renders sponsors correctly', () => { + mount(); + + sponsors.forEach((sponsor, index) => { + cy.get('[data-testid="Sponsors-list"]').eq(index).within(() => { + cy.get('[data-testid="Sponsors-link"]') + .should('have.attr', 'href', sponsor.link) + .should('have.attr', 'target', '_blank') + .should('have.attr', 'rel', 'noopener noreferrer'); + + cy.get('[data-testid="Sponsors-img"]') + .should('have.attr', 'src', sponsor.imageSrc) + .should('have.attr', 'alt', sponsor.altText); + }); + }); + }); + it('shows support banner when showSupportBanner prop is true', () => { + mount(); + cy.contains('Want to become a sponsor?'); + cy.contains('Support us!') + .should('have.attr', 'href', 'https://opencollective.com/asyncapi') + .should('have.attr', 'target', '_blank') + .should('have.attr', 'rel', 'noopener noreferrer'); + }); + + it('does not show support banner when showSupportBanner prop is false', () => { + mount(); + cy.contains('Want to become a sponsor?').should('not.exist'); + cy.contains('Support us!').should('not.exist'); + }); +}); diff --git a/pages/index.js b/pages/index.js index dd742175ecb0..84a4f06a472d 100644 --- a/pages/index.js +++ b/pages/index.js @@ -2,7 +2,7 @@ import Container from '../components/layout/Container' import NavBar from '../components/navigation/NavBar' import Hero from '../components/Hero' import NewsletterSubscribe from '../components/NewsletterSubscribe' -import Sponsors from '../components/Sponsors' +import Sponsors from '../components/sponsors/Sponsors' import Head from '../components/Head' import Slack from '../components/slack' import Button from '../components/buttons/Button' @@ -16,8 +16,8 @@ import Testimonial from '../components/Testimonial' import Heading from '../components/typography/Heading' import Paragraph from '../components/typography/Paragraph' import TextLink from '../components/typography/TextLink' -import GoldSponsors from '../components/GoldSponsors' -import SilverSponsors from '../components/SilverSponsors' +import GoldSponsors from '../components/sponsors/GoldSponsors' +import SilverSponsors from '../components/sponsors/SilverSponsors' import SupportUs from '../components/SupportUs' import StickyNavbar from '../components/navigation/StickyNavbar' import GoogleCalendarButton from '../components/buttons/GoogleCalendarButton';