Alert.jsx 1022 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { Fragment } from 'react'
  2. import styled from 'styled-components'
  3. import t from 'prop-types'
  4. const kinds = {
  5. info: '#5352ED',
  6. positive: '#2ED573',
  7. negative: '#FF4757',
  8. warning: '#FFA502',
  9. }
  10. const AlertStyled = styled('div')`
  11. padding: 15px 20px;
  12. background: white;
  13. border-radius: 3px;
  14. color: white;
  15. background: ${({ kind = 'info' }) => kinds[kind]};
  16. `
  17. export const Alert = props => <AlertStyled {...props} />
  18. Alert.propTypes = {
  19. kind: t.oneOf(['info', 'positive', 'negative', 'warning']),
  20. }
  21. Alert.defaultProps = {
  22. kind: 'info',
  23. }
  24. export function EditButton(props) {
  25. let encodedStatus = encodeURIComponent(
  26. "This live editor looks pretty darn handy #JavaScript"
  27. )
  28. let encodedURL = encodeURIComponent(
  29. "https://ecs.chenxixian.cn/chenxixian/docz/src/master"
  30. )
  31. return (
  32. <a
  33. href={`https://ecs.chenxixian.cn/chenxixian/docz/_edit/master/ALert.mdx`}
  34. target="_blank"
  35. className="EditButton">
  36. Edit This Page!
  37. </a>
  38. )
  39. }