-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: Appliance logo in the app header
- Loading branch information
1 parent
674a388
commit 830cc44
Showing
15 changed files
with
387 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import SvgIconWrapper from './SvgIconWrapper'; | ||
import Enterprise150Svg from 'web/components/icon/svg/Enterprise_150.svg'; | ||
import Enterprise400Svg from 'web/components/icon/svg/Enterprise_400.svg'; | ||
import Enterprise450Svg from 'web/components/icon/svg/Enterprise_450.svg'; | ||
import Enterprise600Svg from 'web/components/icon/svg/Enterprise_600.svg'; | ||
import Enterprise650Svg from 'web/components/icon/svg/Enterprise_650.svg'; | ||
import Enterprise5400Svg from 'web/components/icon/svg/Enterprise_5400.svg'; | ||
import Enterprise6500Svg from 'web/components/icon/svg/Enterprise_6500.svg'; | ||
|
||
const createEnterpriseComponent = Component => () => ( | ||
<SvgIconWrapper size={['150px', '150px']} component={Component} /> | ||
); | ||
|
||
export const Enterprise150 = createEnterpriseComponent(Enterprise150Svg); | ||
export const Enterprise400 = createEnterpriseComponent(Enterprise400Svg); | ||
export const Enterprise450 = createEnterpriseComponent(Enterprise450Svg); | ||
export const Enterprise600 = createEnterpriseComponent(Enterprise600Svg); | ||
export const Enterprise650 = createEnterpriseComponent(Enterprise650Svg); | ||
export const Enterprise5400 = createEnterpriseComponent(Enterprise5400Svg); | ||
export const Enterprise6500 = createEnterpriseComponent(Enterprise6500Svg); |
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,23 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import PropTypes from 'web/utils/proptypes'; | ||
import SvgIcon from './svgicon'; | ||
|
||
const SvgIconWrapper = ({component: Component, size, ...props}) => ( | ||
<SvgIcon size={size} {...props}> | ||
{svgProps => <Component {...svgProps} />} | ||
</SvgIcon> | ||
); | ||
|
||
SvgIconWrapper.propTypes = { | ||
component: PropTypes.node.isRequired, | ||
size: PropTypes.oneOfType([ | ||
PropTypes.oneOf(['tiny', 'small', 'medium', 'large']), | ||
PropTypes.string, | ||
]), | ||
}; | ||
|
||
export default SvgIconWrapper; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,34 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import {describe, test, expect} from '@gsa/testing'; | ||
import {render} from 'web/utils/testing'; | ||
import getLogo from 'web/components/structure/getLogo'; | ||
|
||
describe('getLogo', () => { | ||
const testCases = [ | ||
['gsm-150_label.svg', 'Enterprise150'], | ||
['gsm-400_label.svg', 'Enterprise400'], | ||
['gsm-400r2_label.svg', 'Enterprise400'], | ||
['gsm-450_label.svg', 'Enterprise450'], | ||
['gsm-450r2_label.svg', 'Enterprise450'], | ||
['gsm-600_label.svg', 'Enterprise600'], | ||
['gsm-600r2_label.svg', 'Enterprise600'], | ||
['gsm-650_label.svg', 'Enterprise650'], | ||
['gsm-650r2_label.svg', 'Enterprise650'], | ||
['gsm-5400_label.svg', 'Enterprise5400'], | ||
['gsm-6500_label.svg', 'Enterprise6500'], | ||
]; | ||
|
||
test.each(testCases)('returns %s for %s', (model, expectedTestId) => { | ||
const {getByTestId} = render(getLogo(model)); | ||
expect(getByTestId(expectedTestId)).toBeInTheDocument(); | ||
}); | ||
|
||
test('returns undefined for unknown model', () => { | ||
const result = getLogo('unknown_model.svg'); | ||
expect(result).toBeUndefined(); | ||
}); | ||
}); |
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,52 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import PropTypes from 'web/utils/proptypes'; | ||
import { | ||
Enterprise150, | ||
Enterprise400, | ||
Enterprise450, | ||
Enterprise600, | ||
Enterprise650, | ||
Enterprise5400, | ||
Enterprise6500, | ||
} from 'web/components/icon/GreenboneApplianceLogo'; | ||
|
||
const APPLIANCE_MODELS = { | ||
'gsm-150_label.svg': Enterprise150, | ||
'gsm-400_label.svg': Enterprise400, | ||
'gsm-400r2_label.svg': Enterprise400, | ||
'gsm-450_label.svg': Enterprise450, | ||
'gsm-450r2_label.svg': Enterprise450, | ||
'gsm-600_label.svg': Enterprise600, | ||
'gsm-600r2_label.svg': Enterprise600, | ||
'gsm-650_label.svg': Enterprise650, | ||
'gsm-650r2_label.svg': Enterprise650, | ||
'gsm-5400_label.svg': Enterprise5400, | ||
'gsm-6500_label.svg': Enterprise6500, | ||
}; | ||
|
||
const getLogo = model => { | ||
const Component = APPLIANCE_MODELS[model]; | ||
return Component ? <Component /> : undefined; | ||
}; | ||
|
||
getLogo.propTypes = { | ||
model: PropTypes.oneOf([ | ||
'gsm-150_label.svg', | ||
'gsm-400_label.svg', | ||
'gsm-400r2_label.svg', | ||
'gsm-450_label.svg', | ||
'gsm-450r2_label.svg', | ||
'gsm-600_label.svg', | ||
'gsm-600r2_label.svg', | ||
'gsm-650_label.svg', | ||
'gsm-650r2_label.svg', | ||
'gsm-5400_label.svg', | ||
'gsm-6500_label.svg', | ||
]), | ||
}; | ||
|
||
export default getLogo; |
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