11import React from 'react'
22import styled from 'styled-components'
3+ import FieldsWrapper from './FieldsWrapper'
34
45const Embed = styled . div `
56 max-wdth: 520px;
@@ -10,6 +11,10 @@ const Embed = styled.div`
1011 line-height: 1.375rem;
1112`
1213
14+ const EmbedWrapper = styled . div `
15+ display: flex;
16+ `
17+
1318const EmbedTitle = styled . span `
1419 display: block;
1520 font-weight: 600;
@@ -42,27 +47,81 @@ const AuthorIcon = styled.img`
4247 height: 24px;
4348 object-fit: contain;
4449 border-radius: 50%;
45- }
50+ `
51+
52+ const FooterWrapper = styled . div `
53+ margin-top: 8px;
54+ display: flex;
55+ `
56+
57+ const FooterText = styled . span `
58+ font-size: 0.75rem;
59+ font-weight: 500;
60+ `
61+
62+ const FooterIcon = styled . img `
63+ margin-right: 8px;
64+ width: 20px;
65+ height: 20px;
66+ -o-object-fit: contain;
67+ object-fit: contain;
68+ border-radius: 50%;
69+ `
70+
71+ const Media = styled . img `
72+ max-width: 520px;
73+ border-radius: 4px;
74+ margin-top: 16px;
75+ `
76+
77+ const Thumbnail = styled . img `
78+ width: 80px;
79+ height: 80px;
80+ margin-left: 16px;
81+ margin-top: 8px;
82+ border-radius: 4px;
4683`
4784
4885function MessageEmbed ( props ) {
4986 return < Embed style = { {
5087 borderColor : props . color
5188 } } >
52- {
53- props . author && props . author . name && < EmbedAuthorWrapper >
89+ < EmbedWrapper >
90+ < div >
5491 {
55- props . author . icon && < AuthorIcon src = { props . author . icon } />
92+ props . author && props . author . name && < EmbedAuthorWrapper >
93+ {
94+ props . author . icon && < AuthorIcon src = { props . author . icon } />
95+ }
96+ < EmbedAuthor > { props . author . name } </ EmbedAuthor >
97+ </ EmbedAuthorWrapper >
5698 }
57- < EmbedAuthor > { props . author . name } </ EmbedAuthor >
58- </ EmbedAuthorWrapper >
99+ {
100+ props . title && < EmbedTitle > { props . title } </ EmbedTitle >
101+ }
102+ < EmbedContent >
103+ { props . children }
104+ </ EmbedContent >
105+ {
106+ props . fields && props . fields . length && < FieldsWrapper fields = { props . fields } />
107+ }
108+ </ div >
109+ {
110+ props . thumbnail && < Thumbnail src = { props . thumbnail } />
111+ }
112+ </ EmbedWrapper >
113+
114+ {
115+ props . image && < Media src = { props . image } />
59116 }
60117 {
61- props . title && < EmbedTitle > { props . title } </ EmbedTitle >
118+ props . footer && props . footer . text && < FooterWrapper >
119+ {
120+ props . footer . icon && < FooterIcon src = { props . footer . icon } />
121+ }
122+ < FooterText > { props . footer . text } </ FooterText >
123+ </ FooterWrapper >
62124 }
63- < EmbedContent >
64- { props . children }
65- </ EmbedContent >
66125 </ Embed >
67126}
68127
0 commit comments