Files
extension/packages/extension-ui/src/components/Tip.tsx
T
Jaco Greeff f241e7191d Introduce the enable() interface (prompts user) (#20)
* Introduce the enable() interface

* Provider

* Add auth requests to state

* injector comments

* Background extension list, spprove & reject

* Cleanups

* Untested, but the UI parts are there (test next)

* linting

* Not pretty, but seems to auth

* Small styling adjustments

* Adjust Box layout slightly

* Small styling adjustments

* signing -> transactions

* isDanger for links

* Styling defaults
2019-05-23 12:43:55 +02:00

59 lines
1.2 KiB
TypeScript

// Copyright 2019 @polkadot/extension-ui authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import React from 'react';
import styled from 'styled-components';
import defaults from './defaults';
type Color = {
background: string,
border: string,
color: string
};
type Type = keyof typeof defaults.box;
type Props = {
children: React.ReactNode,
className?: string,
header?: React.ReactNode,
type?: Type
};
function getColor ({ type }: Props): Color {
return defaults.box[type || 'info'] || defaults.box.info;
}
function Tip ({ children, className, header }: Props) {
return (
<article className={className}>
{header && <h3>{header}</h3>}
<div>{children}</div>
</article>
);
}
export default styled(Tip)`
background: ${(props) =>
getColor(props).background
};
border-left: 0.25rem solid ${(props) =>
getColor(props).border
};
box-shadow: ${defaults.boxShadow};
color: ${(props) =>
getColor(props).color
};
margin: ${defaults.boxMargin};
padding: 1rem 1.25rem;
h3 {
color: ${(props) =>
getColor(props).border
};
font-weight: normal;
}
`;