Last active
December 29, 2024 12:41
-
-
Save claytongulick/bf05ecebe7a2bbb96b585b74af203eed to your computer and use it in GitHub Desktop.
Revisions
-
claytongulick revised this gist
Nov 29, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ //a quick example of how to use actual 'if' statements inside template literals, //without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals. //data param is passed in via render(template(data), this) - if not using lit-html, could be any function template = (data) => html` <div id="job_edit" class="modal"> <div class="modal-content"> ${ -
claytongulick revised this gist
Nov 29, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ //a quick example of how to use actual 'if' statements inside template literals, //without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals. template = (data) => html` //data param is passed in via render(template(data), this) - if not using lit-html, could be any function <div id="job_edit" class="modal"> <div class="modal-content"> ${ //we're just going to wrap an anonymous inline function here and then call it with some data (job => { //job here, is just an example, it could be anything, it's passed in below in (data.job) if(job) return html`<h4>Edit Job</h4>` else -
claytongulick revised this gist
Nov 29, 2019 . No changes.There are no files selected for viewing
-
claytongulick created this gist
Feb 23, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ //a quick example of how to use actual 'if' statements inside template literals, //without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals. template = (data) => html` <div id="job_edit" class="modal"> <div class="modal-content"> ${ //we're just going to wrap an anonymous inline function here and then call it with some data (job => { if(job) return html`<h4>Edit Job</h4>` else return html`<h4>Create Job</h4>` })(data.job) //call the anonymous inline with the data we care about } </div> </div> `;