Skip to content

Commit

Permalink
Merge pull request #139 from ligangty/main
Browse files Browse the repository at this point in the history
Change Capabilities section in StoreListingWidget to accept store intead of options
  • Loading branch information
ligangty authored Jan 5, 2024
2 parents 77e6b23 + e7bbda5 commit c02c88b
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@ LocalURLSection.propTypes = {
};

// For options, see AppUtils.remoteOptions|hostedOptions
const CapabilitiesSection = ({options}) => <div className="left-half">
<label>Capabilities:</label>{' '}
{
options.map(option => <div key={option.title} className="options">
<span className="key">{option.icon} </span>
</div>)
}
</div>;
const CapabilitiesSection = ({store}) => {
if(store.type==="remote" || store.type==="hosted"){
const options = Utils.storeOptions(store);
const styleClass = store.type==="remote"?"left-half":"right-half";
return <div className={styleClass}>
<label>Capabilities:</label>{' '}
{
options.map(option => <div key={option.title} className="options">
<span className="key">{option.icon} </span>
</div>)
}
</div>;
}
return <Fragment/>;
};

CapabilitiesSection.propTypes = {
options: PropTypes.array
store: PropTypes.object
};

const StoreNameSection = ({store, storeClass}) => <div className="fieldset-caption">
Expand Down Expand Up @@ -75,10 +82,11 @@ const StoreListingWidget = ({storeList, disableMap, storeType}) => {
<a href={store.url} target="_new">{store.url}</a>
</div>
}
{ storeType === "hosted" && <CapabilitiesSection store={store} />}
</div>
<div>
<CapabilitiesSection options={Utils.storeOptions(store)} />
</div>
{
storeType === "remote" && <div><CapabilitiesSection store={store} /></div>
}
<div className="description field"><span>{store.description}</span></div>
</div>
</div>
Expand Down

0 comments on commit c02c88b

Please sign in to comment.