Sha256: 1a237ebbb2ca063e4e9651ddd6f75361a118f7a726153b2b9b72f344f4d918f6

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

page "PackageDetailsPage"

state
  loaded: false
  package: undefined

properties
  fullWidth: false

events
  componentDidMount: ->
    @fetchStateFromApi() unless @isLoaded()
  
  fetchStateFromApi: ->
    page = @
    slug = @props.slug 
    
    if slug? && _.isUndefined(@state.package)
      stylish.showPackage slug, (pkg)->
        page.setState(package: pkg, loaded: true)

helpers 
  isLoaded: ->
    @state.loaded is true

  getBody: ->
    if @isLoaded() then @showDetails() else @loadingIndicator()
  
  loadingIndicator: ->
    <div className="ui loading indicator">Loading...</div>

  showDetails: ->
    pkg = @state.package
    pkg.categories ||= []

    <div className="ui package details">
      <div className="ui header">
        <h2>{pkg.name}</h2>
      </div>
      <div className="ui segment">
        <div className="ui header">
          <h4>Components</h4>
        </div>
        <div className="ui very relaxed list">
          {React.createElement("div", key: item, className:"item", item) for item in pkg.categories}
        </div>
      </div>
    </div>

view -> 
  <div className="ui page package-details">
    {@getBody()}  
  </div>

module.exports = finished() 

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stylish-0.3.1 support/editor-app/development/src/pages/package_details.cjsx
stylish-0.3.0 support/editor-app/development/src/pages/package_details.cjsx
stylish-0.0.2 support/editor-app/development/src/pages/package_details.cjsx