-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make defcomponent only create the component function object once, add…
… emoji demo
- Loading branch information
Showing
17 changed files
with
9,408 additions
and
7 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
demo-app.js | ||
counter-app/counter-app.js | ||
emoji-search/emoji-search.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
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,11 @@ | ||
(defcomponent (app (object "filteredEmoji" (filter-emoji "" 20))) (set-state state props) | ||
(let ((handle-search-change (lambda (evt) | ||
(funcall set-state (object "filteredEmoji" (filter-emoji (getobj "value" (getobj "target" evt)) 20)))))) | ||
(render | ||
"div" | ||
#() | ||
((header)) | ||
((search-input) (object "textChange" handle-search-change)) | ||
((emoji-results) (object "emojiData" (getobj "filteredEmoji" state)))))) | ||
|
||
(mount "root" (render (app))) |
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,11 @@ | ||
(defcomponent (emoji-results-row nil) (s s2 props) | ||
(declare (ignore s) (ignore s2)) | ||
(let* ((code-point-hex (#j:Number:prototype:toString:call (#j:String:prototype:codePointAt:call (getobj "symbol" props) 0) 16)) | ||
(src (#j:String:prototype:concat:call "http://cdn.jsdelivr.net/emojione/assets/png/" code-point-hex ".png"))) | ||
(render | ||
"div" | ||
(object "className" "component-emoji-result-row copy-to-clipboard" | ||
"data-clipboard-text" (getobj "symbol" props)) | ||
("img" (object "alt" (getobj "title" props) "src" src)) | ||
("span" (object "className" "title") (getobj "title" props)) | ||
("span" (object "className" "info") "Click to copy emoji")))) |
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,13 @@ | ||
(#j:window:construct #j:ClipboardJS ".copy-to-clipboard") | ||
|
||
(defcomponent (emoji-results nil) (s s2 props) | ||
(declare (ignore s) (ignore s2)) | ||
(render | ||
"div" | ||
(object "className" "component-emoji-results") | ||
(apply #'vector (loop for emoji-data in (getobj "emojiData" props) | ||
collect (render | ||
(emoji-results-row) | ||
(object "key" (cdr (assoc :title emoji-data)) | ||
"symbol" (cdr (assoc :symbol emoji-data)) | ||
"title" (cdr (assoc :title emoji-data)))))))) |
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,75 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: sans-serif; | ||
} | ||
.component-header { | ||
padding: 15px; | ||
position: relative; | ||
font-weight: normal; | ||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
font-size: 32px; | ||
text-align: center; | ||
color: #333; | ||
} | ||
|
||
.component-header img { | ||
position: relative; | ||
top: 6px; | ||
padding: 0 14px; | ||
} | ||
|
||
.component-search-input { | ||
border-bottom: 1px solid #ccc; | ||
} | ||
|
||
.component-search-input > div { | ||
margin: 0 10px 10px 10px; | ||
} | ||
|
||
.component-search-input input { | ||
border-radius: 4px; | ||
border: 1px solid #bbb; | ||
box-sizing: border-box; | ||
font-size: 18px; | ||
padding: 10px 8px; | ||
width: 100%; | ||
} | ||
|
||
.component-emoji-result-row { | ||
border-bottom: 1px solid #ccc; | ||
padding: 10px; | ||
height: 32px; | ||
position: relative; | ||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
cursor: pointer; | ||
} | ||
|
||
.component-emoji-result-row:hover { | ||
background-color: #eee; | ||
} | ||
|
||
.component-emoji-result-row img { | ||
width: 32px; | ||
height: 32px; | ||
padding-right: 10px; | ||
} | ||
|
||
.component-emoji-result-row .title { | ||
position: relative; | ||
top: -8px; | ||
} | ||
|
||
.component-emoji-result-row .info { | ||
float: right; | ||
position: relative; | ||
top: 8px; | ||
right: 10px; | ||
color: #ccc; | ||
display: none; | ||
} | ||
|
||
.component-emoji-result-row:hover .info { | ||
display: inline-block; | ||
} | ||
|
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 @@ | ||
<!doctype html> | ||
<html> | ||
<meta charset="UTF-8" /> | ||
<head> | ||
<title>jscl-react demo</title> | ||
<link rel="stylesheet" href="emoji-search.css" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script src="../jscl/jscl.js" type="text/javascript"></script> | ||
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script> | ||
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script> | ||
<script src="https://unpkg.com/clipboard@2/dist/clipboard.min.js"></script> | ||
<script src="../jscl-react.js" type="text/javascript"></script> | ||
<script src="emoji-search.js" type="text/javascript"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.