• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Clojure
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Soda-ash is an interface between clojurescript's Reagent and Semantic UI React

soda-ash

Soda-ash is an interface between clojurescript's reagent and semantic-ui-react.

Usage

Add the following stylesheet to your index.html:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.0/semantic.min.css"></link>

Put the following in the :dependencies vector of your project.clj

[reagent "0.8.1"]
[soda-ash "0.83.0"]

Then require soda-ash in your namespace.

(ns foo.bar
  (:require [soda-ash.core :as sa]))

Example

Let's take a look at a modal. In javascript, you'd write something like this:

import React from 'react'
import { Button, Header, Image, Modal } from 'semantic-ui-react'

const ModalModalExample = () => (
  <Modal trigger={<Button>Show Modal</Button>}>
    <Modal.Header>Select a Photo</Modal.Header>
    <Modal.Content image>
      <Image wrapped size='medium' src='http://semantic-ui.com/images/avatar2/large/rachel.png' />
      <Modal.Description>
        <Header>Default Profile Image</Header>
        <p>We've found the following gravatar image associated with your e-mail address.</p>
        <p>Is it okay to use this photo?</p>
      </Modal.Description>
    </Modal.Content>
  </Modal>
)

export default ModalModalExample

However, in clojurescript with soda-ash, you'd write something like this:

(ns foo.bar
  (:require
   [reagent.core :as reagent]
   [soda-ash.core :as sa]))

(defn modal-example []
  [sa/Modal {:trigger (reagent/as-element [sa/Button "Show Modal"])}
   [sa/ModalHeader "Select a Photo"]
   [sa/ModalContent {:image true}
    [sa/Image {:wrapped true
               :size    "medium"
               :src     "http://semantic-ui.com/images/avatar2/large/rachel.png"}]
    [sa/ModalDescription
     [sa/Header "Default Profile Image"]
     [:p "We've found the following gravatar image associated with your e-mail address."]
     [:p "Is it okay to use this photo?"]
     ]]])

Gotchas

  • Renamed List to ListSA to avoid confusion with clojure.core/list
  • Renamed Comment to CommentSA to avoid confusion with clojure.core/comment

Related

using semantic ui with re-frame blog post by @kennethkalmer

Sodium is a wrapper around soda-ash. Sodium adds two sets of features into the mix, both aimed at making it easier to include Semantic UI in re-frame projects:

  1. Utility functions to get values in and out of components.
  2. Validity-checking aids to help avoid typos.

Questions

If you have questions, I can usually be found hanging out in the clojurians #reagent slack channel (my handle is @gadfly361).

License

Copyright Β© 2016 Matthew Jaoudi

Distributed under the The MIT License (MIT).

More Repositories

1

re-pressed

re-pressed is a clojurescript library that handles keyboard events for re-frame applications.
Clojure
163
star
2

reagent-figwheel

Leiningen template for Reagent applications in Clojurescript with Figwheel. Optionally includes secretary, cljs.test, garden, less, cider, devcards, cljs-devtools, re-risk
Clojure
156
star
3

rid3

Reagent Interface to D3
Clojure
142
star
4

flutter_test_cookbook

A community driven cookbook with recipes (i.e., examples) on how to test your flutter application.
Dart
126
star
5

baking-soda

baking-soda is an interface between clojurescript's reagent and reactstrap (i.e., bootstrap 4 react components) and react-bootstrap (i.e., bootstrap 3 react components)
Clojure
74
star
6

cljs-todomvc

List of TodoMVC examples that use Clojurescript (om, om next, reagent, re-frame, rum, quiescent, etc.)
Clojure
72
star
7

reagent-seed

Clojurescript template for making Reagent applications with Org-mode (includes figwheel, cider, devcards, doo garden, secretary)
Clojure
63
star
8

breaking-point

BREAKING-POINT lets you quickly define and subscribe to screen (i.e. window) breakpoints in your re-frame application
Clojure
39
star
9

re-surface

Add structure to a reagent or re-frame application at the page level (sticky header, sidebar, modal, etc.)
Clojure
34
star
10

re-pollsive

Re-pollsive is a clojurescript library that handles polling events for re-frame applications
Clojure
34
star
11

gadfly-blog

https://gadfly361.github.io/gadfly-blog/
HTML
4
star
12

reagent-tic-tac-toe

Tic Tac Toe built with Reagent
CSS
2
star
13

reagent-cookbook-template

Template for Reagent Cookbook recipes
Clojure
2
star
14

flutter_services_example

An example Flutter app using "Services" state-management
Dart
1
star