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

feat: revert to using icons from cloudinary #344

Merged
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
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ const config = {
docs: {
autodocs: "tag",
},
staticDirs: ["./public", "../public"],
staticDirs: ["./public"],
};
export default config;
10 changes: 7 additions & 3 deletions src/components/atoms/OakIcon/OakIcon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,20 @@ describe("isValidIconName", () => {

describe("generateOakIconURL", () => {
it("is valid url when the string is a valid icon name", () => {
expect(generateOakIconURL("home")).toBe("svgs/icons/home.svg");
expect(generateOakIconURL("home")).toBe(
"https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699887218/icons/gvqxjxcw07ei2kkmwnes.svg",
);
});

it("is returns url for question mark when the string is not a valid icon name", () => {
expect(generateOakIconURL("banana-sandwich")).toBe(
"svgs/icons/question-mark.svg",
"https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1706872277/icons/question-mark.svg",
);
});

it("is returns url for books when the string is not a valid subject icon name", () => {
expect(generateOakIconURL("subject-potions")).toBe("svgs/icons/books.svg");
expect(generateOakIconURL("subject-potions")).toBe(
"https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953657/icons/hz4l3iq6i68kazvkvorq.svg",
);
});
});
2 changes: 1 addition & 1 deletion src/components/atoms/OakIcon/OakIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function isValidIconName(iconName: string): iconName is OakIconName {
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
*/
export function generateOakIconURL(iconName: string) {
const urlPath = `svgs`;
const urlPath = `https://${process.env.NEXT_PUBLIC_OAK_ASSETS_HOST}/${process.env.NEXT_PUBLIC_OAK_ASSETS_PATH}`;
if (isValidIconName(iconName)) {
return `${urlPath}/${icons[iconName]}`;
} else if (iconName.includes("subject")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`OakIcon matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/home.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699887218/icons/gvqxjxcw07ei2kkmwnes.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ exports[`InternalChevronAccordion matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-down.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953557/icons/botfld6brychmttwtv6u.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ exports[`InternalShadowRectButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ exports[`InternalShadowRoundButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ exports[`OakAccordion matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-down.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953557/icons/botfld6brychmttwtv6u.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`OakBackLink matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-left.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707752509/icons/rbvzan0ozubmr4j0uqdn.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ input:checked + .c7 {
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/tick.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699954310/icons/efd3esaor6zqk7seh6kt.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ exports[`OakCopyLinkButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/copy.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1727861316/icons/Icon_Copy_qxgynv.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ exports[`OakDragAndDropInstructions matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/move-arrows.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1709052869/icons/hoddjsgpzkszgvnmn91q.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ exports[`OakDraggable matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/move-arrows.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1709052869/icons/hoddjsgpzkszgvnmn91q.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ exports[`OakDraggableFeedback matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/tick.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699954310/icons/efd3esaor6zqk7seh6kt.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ exports[`OakFilterDrawer matches snapshot when mounted 1`] = `
data-nimg="fill"
decoding="async"
loading="lazy"
src="http://localhost/svgs/icons/cross.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699895179/icons/xigimrbivcaxt4omxamp.svg"
style="position: absolute; height: 100%; width: 100%; left: 0px; top: 0px; right: 0px; bottom: 0px; color: transparent;"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ exports[`OakHandDrawnCardWithIcon matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/worksheet-3.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699895429/icons/bzhojpjxp9rukdvh7daz.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ exports[`OakInlineBanner matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/info.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1709052869/icons/Icon_Info_vsx3xi.svg"
style={
{
"bottom": 0,
Expand Down Expand Up @@ -449,7 +449,7 @@ exports[`OakInlineBanner matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/cross.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699895179/icons/xigimrbivcaxt4omxamp.svg"
style={
{
"bottom": 0,
Expand Down Expand Up @@ -494,7 +494,7 @@ exports[`OakInlineBanner matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707752509/icons/vk9xxxhnsltsickom6q9.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ exports[`OakLessonInfoCard component test matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/question-mark.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1706872277/icons/question-mark.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ exports[`OakMediaClipListAccordion matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-down.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953557/icons/botfld6brychmttwtv6u.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ exports[`OakModal matches snapshot when mounted 1`] = `
data-nimg="fill"
decoding="async"
loading="lazy"
src="http://localhost/svgs/icons/cross.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699895179/icons/xigimrbivcaxt4omxamp.svg"
style="position: absolute; height: 100%; width: 100%; left: 0px; top: 0px; right: 0px; bottom: 0px; color: transparent;"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ exports[`OakModalCenter matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/cross.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699895179/icons/xigimrbivcaxt4omxamp.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ exports[`OakModalCenterBody matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/content-guidance.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699954277/icons/tm3uhcqenaznq4fxys7j.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ exports[`OakOutlineAccordion matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-down.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953557/icons/botfld6brychmttwtv6u.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ exports[`OakPrimaryButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ exports[`OakPrimaryInvertedButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`OakRoundIcon matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/home.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699887218/icons/gvqxjxcw07ei2kkmwnes.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ exports[`OakScaleImageButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/expand.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1730982187/Icon_Expand_arrktl.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ exports[`OakSecondaryButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ exports[`OakSignLanguageButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/sign-language.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953861/icons/ns94ozvozzi22enxkx0x.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ exports[`OakSmallPrimaryButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ exports[`OakSmallSecondaryButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ exports[`OakDownloadsJourneyChildSubjectTierSelector matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/info.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1709052869/icons/Icon_Info_vsx3xi.svg"
style={
{
"bottom": 0,
Expand Down Expand Up @@ -590,7 +590,7 @@ exports[`OakDownloadsJourneyChildSubjectTierSelector matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/arrow-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707149070/icons/fv0z57zerrioft52dd9n.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ exports[`OakPupilJourneyHeader matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/subject-icons/science.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/subject-icons/science.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ exports[`OakPupilJourneyListItem matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707752509/icons/vk9xxxhnsltsickom6q9.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ exports[`OakPupilJourneyOptionalityButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707752509/icons/vk9xxxhnsltsickom6q9.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ exports[`OakPupilJourneyOptionalityItem component test matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707752509/icons/vk9xxxhnsltsickom6q9.svg"
style={
{
"bottom": 0,
Expand Down Expand Up @@ -481,7 +481,7 @@ exports[`OakPupilJourneyOptionalityItem component test matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-right.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1707752509/icons/vk9xxxhnsltsickom6q9.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ exports[`OakPupilJourneySubjectButton matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/subject-icons/english.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/subject-icons/english.svg"
style={
{
"bottom": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ exports[`PupilJourneyUnitsFilter matches snapshot 1`] = `
loading="lazy"
onError={[Function]}
onLoad={[Function]}
src="svgs/icons/chevron-down.svg"
src="https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953557/icons/botfld6brychmttwtv6u.svg"
style={
{
"bottom": 0,
Expand Down
Loading
Loading