-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Material UI styling with CSS (#9503)
- Loading branch information
Showing
79 changed files
with
1,270 additions
and
1,846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
frontend/app-development/common/hooks/useMediaQuery.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { renderHook } from '@testing-library/react'; | ||
|
||
import { useMediaQuery } from './useMediaQuery'; | ||
|
||
// Test data: | ||
const query = '(min-width: 600px)'; | ||
|
||
describe('useMediaQuery', () => { | ||
afterEach(() => jest.resetAllMocks()); | ||
|
||
it.each([true, false])( | ||
'Returns value from window.matchMedia.matches when it is %s', | ||
(matches) => { | ||
const matchMediaValue = matchMediaValueMock({ matches }); | ||
const { result } = renderHook(() => useMediaQuery(query)); | ||
expect(matchMediaValue).toHaveBeenCalledWith(query); | ||
expect(result.current).toBe(matches); | ||
}, | ||
); | ||
|
||
it('Adds event listener', () => { | ||
const addEventListener = jest.fn(); | ||
matchMediaValueMock({ addEventListener }); | ||
renderHook(() => useMediaQuery(query)); | ||
expect(addEventListener).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('Removes the event listener on unmount', () => { | ||
const removeEventListener = jest.fn(); | ||
matchMediaValueMock({ removeEventListener }); | ||
const { unmount } = renderHook(() => useMediaQuery(query)); | ||
expect(removeEventListener).not.toHaveBeenCalled(); | ||
unmount(); | ||
expect(removeEventListener).toHaveBeenCalledTimes(1); | ||
}); | ||
}); | ||
|
||
const matchMediaValueMock = ({ | ||
matches, | ||
addEventListener, | ||
removeEventListener, | ||
}: Partial<{ | ||
matches: boolean; | ||
addEventListener: jest.Mock; | ||
removeEventListener: jest.Mock; | ||
}>) => { | ||
const value = jest.fn().mockImplementation((query) => ({ | ||
matches: matches ?? false, | ||
media: query, | ||
onchange: null, | ||
addEventListener: addEventListener ?? jest.fn(), | ||
removeEventListener: removeEventListener ?? jest.fn(), | ||
dispatchEvent: jest.fn(), | ||
})); | ||
Object.defineProperty(window, 'matchMedia', { writable: true, value }); | ||
return value; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useEffect, useState } from 'react'; | ||
|
||
export function useMediaQuery(query: string): boolean { | ||
const getMatches = (query: string): boolean => | ||
window?.matchMedia(query).matches ?? false; | ||
|
||
const [matches, setMatches] = useState<boolean>(getMatches(query)); | ||
|
||
const eventListener = () => { | ||
setMatches(getMatches(query)); | ||
}; | ||
|
||
useEffect(() => { | ||
const matchMedia = window.matchMedia(query); | ||
eventListener(); | ||
matchMedia.addEventListener('change', eventListener); | ||
return () => matchMedia.removeEventListener('change', eventListener); | ||
}, [query]); // eslint-disable-line react-hooks/exhaustive-deps | ||
|
||
return matches; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
frontend/app-development/features/appPublish/components/appDeploymentComponent.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
.mainContainer { | ||
height: fit-content; | ||
} | ||
|
||
.headingContainer { | ||
border-bottom: 2px solid #C9C9C9; | ||
border-top: 2px solid #000000; | ||
margin-bottom: 3.6rem; | ||
margin-top: 2rem; | ||
padding: 2rem 5rem; | ||
width: 100%; | ||
} | ||
|
||
.dropdownGrid { | ||
padding-bottom: 5rem; | ||
padding-left: 5rem; | ||
padding-right: 6rem; | ||
} | ||
|
||
.select { | ||
max-width: 34rem; | ||
z-index: 900; | ||
} | ||
|
||
.gridItem { | ||
padding-right: 2rem; | ||
} | ||
|
||
.gridBorder { | ||
border: 1px solid black; | ||
} | ||
|
||
.gridEnvTitle { | ||
max-width: 22.5rem; | ||
padding-right: 0.5rem; | ||
} | ||
|
||
.envTitle { | ||
font-size: 18px; | ||
font-weight: 500; | ||
} | ||
|
||
.table { | ||
background-color: #ffffff; | ||
min-width: 30rem; | ||
} | ||
|
||
.colorBlack { | ||
color: #000; | ||
} | ||
|
||
.tableRow { | ||
height: 2.6rem; | ||
} | ||
|
||
.tableWrapper { | ||
max-height: 350px; | ||
overflow: auto; | ||
} | ||
|
||
.deployButton { | ||
margin-top: 2.6rem; | ||
} | ||
|
||
.deployStatusGridContainer { | ||
margin-top: 2.6rem; | ||
} | ||
|
||
.deploySpinnerGridItem { | ||
min-width: 4.4rem; | ||
} | ||
|
||
.deploymentListGrid { | ||
padding-left: 4.8rem; | ||
} | ||
|
||
.deployUnavailableContainer { | ||
background-color: #F9CAD3; | ||
padding: 1.2rem; | ||
} | ||
|
||
.paperProps { | ||
background-color: #F9CAD3; | ||
} | ||
|
||
.typographyTekniskFeilkode { | ||
padding-top: 1.2rem; | ||
} |
Oops, something went wrong.