-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
321 additions
and
15 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -3,4 +3,6 @@ | |
/node_modules | ||
|
||
# production | ||
/dist | ||
/dist | ||
|
||
.DS_Store |
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
Binary file not shown.
122 changes: 122 additions & 0 deletions
122
src/component/content/component/emoji/component/emoji/constant.js
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,122 @@ | ||
export const EMOJI_MAP = [ | ||
{ | ||
code: 'daku', | ||
src: require('./images/daku.png'), | ||
}, | ||
{ | ||
code: 'daliuhan', | ||
src: require('./images/daliuhan.png'), | ||
}, | ||
{ | ||
code: 'danyanxiao', | ||
src: require('./images/danyanxiao.png'), | ||
}, | ||
{ | ||
code: 'dianzan', | ||
src: require('./images/dianzan.png'), | ||
}, | ||
{ | ||
code: 'fennu', | ||
src: require('./images/fennu.png'), | ||
}, | ||
{ | ||
code: 'huaji', | ||
src: require('./images/huaji.png'), | ||
}, | ||
{ | ||
code: 'fennuhuaji', | ||
src: require('./images/fennuhuaji.png'), | ||
}, | ||
{ | ||
code: 'guaiqiao', | ||
src: require('./images/guaiqiao.png'), | ||
}, | ||
{ | ||
code: 'jingku', | ||
src: require('./images/jingku.png'), | ||
}, | ||
{ | ||
code: 'jingya', | ||
src: require('./images/jingya.png'), | ||
}, | ||
{ | ||
code: 'kewang', | ||
src: require('./images/kewang.png'), | ||
}, | ||
{ | ||
code: 'liuhan', | ||
src: require('./images/liuhan.png'), | ||
}, | ||
{ | ||
code: 'liuhan1', | ||
src: require('./images/liuhan1.png'), | ||
}, | ||
{ | ||
code: 'low', | ||
src: require('./images/low.png'), | ||
}, | ||
{ | ||
code: 'miyanxiao', | ||
src: require('./images/miyanxiao.png'), | ||
}, | ||
{ | ||
code: 'miyanxiao1', | ||
src: require('./images/miyanxiao1.png'), | ||
}, | ||
{ | ||
code: 'mojing', | ||
src: require('./images/mojing.png'), | ||
}, | ||
{ | ||
code: 'moneyface', | ||
src: require('./images/moneyface.png'), | ||
}, | ||
{ | ||
code: 'outu', | ||
src: require('./images/outu.png'), | ||
}, | ||
{ | ||
code: 'qiang', | ||
src: require('./images/qiang.png'), | ||
}, | ||
{ | ||
code: 'shuijiao', | ||
src: require('./images/shuijiao.png'), | ||
}, | ||
{ | ||
code: 'smile', | ||
src: require('./images/smile.png'), | ||
}, | ||
{ | ||
code: 'tushe', | ||
src: require('./images/tushe.png'), | ||
}, | ||
{ | ||
code: 'weiqu', | ||
src: require('./images/weiqu.png'), | ||
}, | ||
{ | ||
code: 'xiaoxin', | ||
src: require('./images/xiaoxin.png'), | ||
}, | ||
{ | ||
code: 'xiaoyan', | ||
src: require('./images/xiaoyan.png'), | ||
}, | ||
{ | ||
code: 'xiexiao', | ||
src: require('./images/xiexiao.png'), | ||
}, | ||
{ | ||
code: 'xieyanxiao', | ||
src: require('./images/xieyanxiao.png'), | ||
}, | ||
{ | ||
code: 'yeah', | ||
src: require('./images/yeah.png'), | ||
}, | ||
{ | ||
code: 'yihuo', | ||
src: require('./images/yihuo.png'), | ||
}, | ||
]; |
Binary file added
BIN
+4.88 KB
src/component/content/component/emoji/component/emoji/images/daku.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.93 KB
src/component/content/component/emoji/component/emoji/images/daliuhan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.86 KB
src/component/content/component/emoji/component/emoji/images/danyanxiao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.95 KB
src/component/content/component/emoji/component/emoji/images/dianzan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.89 KB
src/component/content/component/emoji/component/emoji/images/fennu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.79 KB
src/component/content/component/emoji/component/emoji/images/fennuhuaji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.02 KB
src/component/content/component/emoji/component/emoji/images/guaiqiao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.8 KB
src/component/content/component/emoji/component/emoji/images/huaji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.82 KB
src/component/content/component/emoji/component/emoji/images/jingku.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.68 KB
src/component/content/component/emoji/component/emoji/images/jingya.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.9 KB
src/component/content/component/emoji/component/emoji/images/kewang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.8 KB
src/component/content/component/emoji/component/emoji/images/liuhan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.8 KB
src/component/content/component/emoji/component/emoji/images/liuhan1.png
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.
Binary file added
BIN
+4.91 KB
src/component/content/component/emoji/component/emoji/images/miyanxiao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.76 KB
src/component/content/component/emoji/component/emoji/images/miyanxiao1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.03 KB
src/component/content/component/emoji/component/emoji/images/mojing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.87 KB
src/component/content/component/emoji/component/emoji/images/moneyface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.98 KB
src/component/content/component/emoji/component/emoji/images/outu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.89 KB
src/component/content/component/emoji/component/emoji/images/qiang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.76 KB
src/component/content/component/emoji/component/emoji/images/shuijiao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.8 KB
src/component/content/component/emoji/component/emoji/images/smile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.79 KB
src/component/content/component/emoji/component/emoji/images/tushe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.86 KB
src/component/content/component/emoji/component/emoji/images/weiqu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.71 KB
src/component/content/component/emoji/component/emoji/images/xiaoxin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.64 KB
src/component/content/component/emoji/component/emoji/images/xiaoyan.png
Oops, something went wrong.
Binary file added
BIN
+4.81 KB
src/component/content/component/emoji/component/emoji/images/xiexiao.png
Oops, something went wrong.
Binary file added
BIN
+4.67 KB
src/component/content/component/emoji/component/emoji/images/xieyanxiao.png
Oops, something went wrong.
Binary file added
BIN
+4.12 KB
src/component/content/component/emoji/component/emoji/images/yeah.png
Oops, something went wrong.
Binary file added
BIN
+4.77 KB
src/component/content/component/emoji/component/emoji/images/yihuo.png
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
src/component/content/component/emoji/component/emoji/index.js
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,20 @@ | ||
// import a from './images/daku.png'; | ||
import React, { memo } from 'react'; | ||
import { EMOJI_MAP } from './constant'; | ||
import styles from './index.less'; | ||
|
||
export default memo(({ onAdd }) => { | ||
return ( | ||
<div className={styles.emojiContaienr}> | ||
{EMOJI_MAP.map((item) => ( | ||
<a | ||
key={item.code} | ||
className={styles.emojiItem} | ||
onClick={() => onAdd(item.code)} | ||
> | ||
<img src={item.src.default} /> | ||
</a> | ||
))} | ||
</div> | ||
); | ||
}); |
24 changes: 24 additions & 0 deletions
24
src/component/content/component/emoji/component/emoji/index.less
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,24 @@ | ||
.emojiContaienr { | ||
display: flex; | ||
align-items: center; | ||
flex-wrap: wrap; | ||
.emojiItem { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 32px; | ||
height: 32px; | ||
cursor: pointer; | ||
padding: 5px; | ||
transition: all 0.3s; | ||
img { | ||
display: block; | ||
} | ||
} | ||
.emojiItem:avtive { | ||
background: #888483; | ||
} | ||
.emojiItem:hover { | ||
transform: scale(1.1); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/component/content/component/emoji/component/textEmoji/index.js
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,5 @@ | ||
import React from 'react'; | ||
|
||
export default () => { | ||
return <div>etxt</div>; | ||
}; |
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,17 @@ | ||
import Emoji from './component/emoji'; | ||
import TextEmoji from './component/textEmoji'; | ||
|
||
export const EMOJI_PREFIX = '::'; | ||
|
||
export const EMOJI_TYPE = [ | ||
{ | ||
code: 'emoji', | ||
component: () => Emoji, | ||
text: 'emoji表情', | ||
}, | ||
{ | ||
code: 'textEmoji', | ||
text: '颜表情', | ||
component: () => TextEmoji, | ||
}, | ||
]; |
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,31 @@ | ||
// import a from './images/daku.png'; | ||
import React, { memo, useState, useMemo } from 'react'; | ||
import { EMOJI_TYPE } from './constant'; | ||
import styles from './index.less'; | ||
|
||
export default memo(({ onAdd }) => { | ||
const [active, setKey] = useState(EMOJI_TYPE[0].code); | ||
const Component = EMOJI_TYPE.find((item) => item.code === active).component(); | ||
const menus = useMemo( | ||
() => EMOJI_TYPE.map(({ code, text }) => ({ code, text })), | ||
[EMOJI_TYPE], | ||
); | ||
return ( | ||
<div className={styles.emojiBox}> | ||
<div className={styles.emojiMenu}> | ||
{menus.map(({ code, text }) => ( | ||
<a | ||
className={code === active ? styles.current : ''} | ||
onClick={() => setKey(code)} | ||
key={code} | ||
> | ||
{text} | ||
</a> | ||
))} | ||
</div> | ||
<div className={styles.container} key={active}> | ||
<Component onAdd={onAdd} /> | ||
</div> | ||
</div> | ||
); | ||
}); |
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,32 @@ | ||
.emojiBox { | ||
width: 100%; | ||
border: 1px solid rgba(115, 115, 115, 0.2); | ||
.emojiMenu { | ||
height: 32px; | ||
a { | ||
margin: 0 10px; | ||
padding-bottom: 6px; | ||
font-size: 13px; | ||
cursor: pointer; | ||
} | ||
a.current { | ||
border-bottom: 1px solid #424242; | ||
cursor: not-allowed; | ||
} | ||
} | ||
} | ||
.container { | ||
opacity: 0; | ||
transform: translate3d(30px, 0, 0); | ||
animation: show 0.3s forwards; | ||
} | ||
@keyframes show { | ||
from { | ||
opacity: 0; | ||
transform: translate3d(30px, 0, 0); | ||
} | ||
to { | ||
opacity: 1; | ||
transform: translate3d(0, 0, 0); | ||
} | ||
} |
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
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
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,14 @@ | ||
import { EMOJI_MAP } from '../emoji//component/emoji/constant'; | ||
import { EMOJI_PREFIX } from '../emoji/constant'; | ||
export function replaceEmoji(value) { | ||
if (!value) return ''; | ||
return replace(value); | ||
} | ||
|
||
function replace(str) { | ||
EMOJI_MAP.forEach(({ code, src }) => { | ||
const reg = new RegExp(`${EMOJI_PREFIX}${code}${EMOJI_PREFIX}`); | ||
str = str.replace(eval(`${reg}g`), `<img src="${src.default}"/>`); | ||
}); | ||
return str; | ||
} |
Oops, something went wrong.