Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #2

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9ec43f9
Created the repo + added the modules
adrienthiery Jul 16, 2015
997f4e4
Added README + bower
adrienthiery Jul 16, 2015
a156437
Added bower_components to gitignore
adrienthiery Jul 16, 2015
d5611d1
Still figuring out what main.js is useful for
adrienthiery Jul 16, 2015
e6df9b1
Think about adding dependencies between react components
adrienthiery Jul 18, 2015
4e1ef3d
Added generator v0.1
adrienthiery Jul 18, 2015
b40a69b
Fixed generator + executed it !
adrienthiery Jul 19, 2015
ab0418f
Cleaned generator
adrienthiery Jul 19, 2015
73ddbaf
Added 'html data-advice' for placeholder
adrienthiery Jul 19, 2015
4cac30a
Fixed 'push for single' error + changed props transfer
adrienthiery Jul 19, 2015
a8718b3
To allow cascade props transfer, we need to refer to props as this.pr…
adrienthiery Jul 19, 2015
375f3d8
Rebuilt
adrienthiery Jul 19, 2015
5e2e1dd
A bit nicer
adrienthiery Jul 19, 2015
ed30afe
Rebuilt
adrienthiery Jul 19, 2015
5fbc83f
Update README.md
Jul 19, 2015
2de153b
moved code to src folder
adrienthiery Jul 26, 2015
fb15aaa
Added gulp file
adrienthiery Jul 26, 2015
4522622
Added gulp for minifying + get rid of requirejs
adrienthiery Jul 26, 2015
e9b6545
Removed requirejs use + added react.min.js to dist minified js
adrienthiery Jul 26, 2015
51da79d
Rebuild without requirejs
adrienthiery Jul 26, 2015
9c21802
Added dist of bare ReactJS elements
adrienthiery Jul 26, 2015
73ed0b1
Reformatted tools without requirejs + put react as first in minified …
adrienthiery Jul 26, 2015
206f9a6
Add person HTML
adrienthiery Jul 19, 2015
eca0b3f
Added product html
adrienthiery Jul 19, 2015
66bcb98
Added css
adrienthiery Jul 19, 2015
1913a87
Done customizing for person for ReelyActive
adrienthiery Jul 19, 2015
eaca177
Ordered layout for reelyActive useful components
adrienthiery Jul 19, 2015
d532e61
Rebuilt minjs
adrienthiery Jul 26, 2015
b52ae3e
Added device representation
adrienthiery Jul 27, 2015
d6e7002
Added mapping function
adrienthiery Sep 7, 2015
87d16ab
Updated device React component for chickadee
adrienthiery Sep 8, 2015
dff5c58
Build not dist
adrienthiery Sep 8, 2015
4000481
Added device to "chooser" and adding device as expected for chickadee
adrienthiery Sep 8, 2015
0759816
Added worksFor in translateToJSONLD tool
adrienthiery Sep 10, 2015
2146299
Initial commit
jeffyactive Sep 11, 2015
6df2a4a
Added MIT License
jeffyactive Sep 11, 2015
3c06046
Refactored Generator
adrienthiery Feb 14, 2016
7e72c4f
Moved all generator files in folder + added package.json for dev
adrienthiery Feb 14, 2016
05bae83
Cleaning old cormorant files
adrienthiery Feb 14, 2016
a8a9bea
Compilation with babel/es6
adrienthiery Feb 15, 2016
60102a4
Handling different possible types better
adrienthiery Feb 21, 2016
72fa466
Rebuild elements
adrienthiery Feb 21, 2016
215acdb
Updated css classes for container
adrienthiery Feb 27, 2016
2a635fa
Rebuild
adrienthiery Feb 27, 2016
478946f
Basic display working, but images
adrienthiery Mar 2, 2016
6498974
Added minified
adrienthiery Apr 8, 2016
a001214
Created JS parser and writer instead of python
adrienthiery Jun 4, 2016
a4b356c
Refactoring
adrienthiery Jun 4, 2016
8a28cd3
Created writer as JS + generated ReelyActive specific React Components
adrienthiery Jun 7, 2016
e2bb341
Rebuild dist min
adrienthiery Jun 7, 2016
b365de3
Rebuilt both dist + added all-of-it npm command
adrienthiery Jun 7, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bower_components/
node_modules/
npm-debug.log
.module-cache
*.pyc
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,71 @@ cuttlefish
Human-friendly HTML rendering of machine-friendly JSON-LD
---------------------------------------------------------

Description to come.

Cuttlefish allows you to get HTML out of almost any JSON-LD data structure by providing [ReactJS](https://facebook.github.io/react/) component based on the [Schema.org](http://schema.org/) definition of entities.

What's in a name?
-----------------

Story to come.

How do I use it?
----------

The basic compiled version allows you to visualise `Person`s, `Product`s and `Place`s. (see `index.html` example)

To use it, all you need to do is :

* Install cuttlefish with bower

```sh
bower install cuttlefish
```

* Insert it in your webpage (before your scripts) and insert a node in which to insert the representation

```html
<!-- In the *head* tag (if you want our default style) -->
<link rel='stylesheet' href='bower_components/cuttlefish/dist/cuttlefish.css' />
<!-- Somewhere in the body -->
<div id='myJSON-LDRepresentationContainer'>
</div>
...
<script src='bower_components/cuttlefish/dist/cuttlefish.min.js'></script>
...
```

* Call it with your JSON-ld and the ID of your node

```javascript
cuttlefish.represent(JSONLDData, 'myJSON-LDRepresentationContainer');
```

* Check out your HTML (right-click + inspect in Google Chrome)

Develop
-------

Ok, that's nice, but now, you want to put your hands in the dough.

There are three ways to do that:

* You want to change the style of what you see ...

* ... by modifying only certain attributes? Just create a CSS file and override the classes you want by using the ID of the container as a higher CSS specificity selector!

* ... by starting from scratch? Remove our stylesheet in the *head* tag and create your own, you will find that cuttlefish tries to follow the [SUIT CSS naming convention](https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md) to make it easy for you to style.

* You want to customize the HTML itself, or extend the React components for them to really do something!

* Fork this repo
* In the `src/es6/` folder, you will find the components: Modify them as you want!
* To Rebuild the all in one dist file: run `npm install && npm run build-dist`

* You want to adapt cuttlefish to YOUR data structure:
* Put an extensive example of your JSON-LD data in the `source.json` file
* Run the `npm run generate-source` command
* Look in `src/es6` and you should have the corresponding react components in Ecma script 6 syntax. Customize them as you want and
* Run `npm run build` to get the new version of Cuttlefish with YOUR React components packaged. If you are happy with them, run `npm run build-dist` to generate the distribution-ready version (minified and stuff)

License
-------
Expand All @@ -31,4 +88,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

17 changes: 15 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
{
"name": "cuttlefish",
"version": "0.0.2",
"description": "Human-friendly HTML rendering of machine-friendly JSON-LD. We believe in an open Internet of Things.",
"homepage": "https://github.com/reelyactive/cuttlefish",
"keywords": [
"JSON-LD",
"IoT"
],
"authors": [
{ "name": "Adrien Thiery" }
"Adrien Thiery <[email protected]>"
],
"repository": {
"type": "git",
"url": "git://github.com/reelyactive/cuttlefish.git"
},
"license": "MIT"
"license": "MIT",
"main": "dist/cuttlefish.min.js",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
},
"devDependencies": {}
}
111 changes: 111 additions & 0 deletions dist/cuttlefish.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

@font-face {
font-family: 'EntypoRegular';
src: url('../font/entypo.eot');
src: url('../font/entypo.eot?#iefix') format('embedded-opentype'),
url('../font/entypo.woff') format('woff'),
url('../font/entypo.ttf') format('truetype'),
url('../font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'EntypoSocial';
src: url('../font/entypo-social.eot');
src: url('../font/entypo-social.eot?#iefix') format('embedded-opentype'),
url('../font/entypo-social.woff') format('woff'),
url('../font/entypo-social.ttf') format('truetype'),
url('../font/entypo-social.svg#entypo-social') format('svg');
font-weight: normal;
font-style: normal;
}

img {
display: block;
max-width: 100%;
}

a {
color: #0770a2;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

.entity {
border: solid 1px #ddd;
font-size: 0.8em;
padding: 5px;
background-color: white;
margin: 5px;
clear: both;
}

.Device + .Device {
margin-top: 10px;
}

/* Colored !
.Device {
border-color: #FFAC71;
background-color: #FFDFA6;
}

.Person {
border-color: #BFD4FF;
background-color: #BFD4FF;
}

.Product {
border-color: #FFFF82;
background-color: #FFFF82;
}

.tiraid {
border-color: #CCCCCC;
background-color: #EEEEEE;
}
*/

.clear {
clear: both;
}

.Person img, .Device img {
max-width: 8em;
max-height: 8em;
width: auto;
height: auto;
float: left;
margin: 5px;
}

.Person .clear, .Device .clear {
clear: both;
}

img.icon {
clear: both;
max-height: 2em;
}

/* Icons */
.icon {
font-family: 'EntypoRegular';
font-size: 2em;
display: inline-block;
margin-right: 5px;
vertical-align: bottom;
}
.social {
font-family: 'EntypoSocial';
}

Loading