1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/ui/components/app/permissions-connect-header/permissions-connect-header.component.js
Frederik Bolding 789779f4d5
[FLASK] Rework Snaps headers and footers (#19442)
* Add new snap header and footer to snap install

* Add new snap header and footer to snap result and snap update

* Fix loading state

* Fix lint

* Add required scrolling

* Adjust avatar component

* Apply new headers and footers to snaps confirmations

* Rename previous SnapAuthorship component to SnapAuthorshipExpanded

* Fix lint

* Fix font weight

* Fix fencing

* Fix a test

* Fix lint after rebase

* Fix E2E

* Fix locale lint

* Fix another E2E

* Fix test ID

* Address PR comments

* Better scroll button centering

* Address design comments

* Fix unit test

* Fix E2Es
2023-06-07 15:18:49 +02:00

65 lines
1.7 KiB
JavaScript

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import classnames from 'classnames';
import SiteOrigin from '../../ui/site-origin';
import Box from '../../ui/box';
import {
FLEX_DIRECTION,
JustifyContent,
} from '../../../helpers/constants/design-system';
export default class PermissionsConnectHeader extends Component {
static propTypes = {
className: PropTypes.string,
iconUrl: PropTypes.string,
iconName: PropTypes.string.isRequired,
siteOrigin: PropTypes.string.isRequired,
headerTitle: PropTypes.node,
boxProps: PropTypes.shape({ ...Box.propTypes }),
headerText: PropTypes.string,
leftIcon: PropTypes.node,
rightIcon: PropTypes.node,
};
static defaultProps = {
iconUrl: null,
headerTitle: '',
headerText: '',
boxProps: {},
};
renderHeaderIcon() {
const { iconUrl, iconName, siteOrigin, leftIcon, rightIcon } = this.props;
return (
<div className="permissions-connect-header__icon">
<SiteOrigin
chip
siteOrigin={siteOrigin}
title={siteOrigin}
iconSrc={iconUrl}
name={iconName}
leftIcon={leftIcon}
rightIcon={rightIcon}
/>
</div>
);
}
render() {
const { boxProps, className, headerTitle, headerText } = this.props;
return (
<Box
className={classnames('permissions-connect-header', className)}
flexDirection={FLEX_DIRECTION.COLUMN}
justifyContent={JustifyContent.center}
{...boxProps}
>
{this.renderHeaderIcon()}
<div className="permissions-connect-header__title">{headerTitle}</div>
<div className="permissions-connect-header__subtitle">{headerText}</div>
</Box>
);
}
}