mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 16:09:31 +03:00
sorting the anchor
This commit is contained in:
parent
cd35cc966d
commit
35c3974d0d
@ -20,7 +20,13 @@ Links = React.createFactory query {
|
||||
displayName: "Links"
|
||||
render: -> div {className:'links'}, @props.children, @_render()
|
||||
_render: ->
|
||||
keys = _(@props.kids).keys().sort()
|
||||
sorted = true
|
||||
keys = []
|
||||
for k,v of @props.kids
|
||||
if not v.meta.sort then sorted = false
|
||||
keys[Number(v.meta.sort)] = k
|
||||
if sorted isnt true
|
||||
keys = _(@props.kids).keys().sort()
|
||||
style = {marginTop: -24 * (keys.indexOf @props.curr) + "px"}
|
||||
div {id:"sibs",style}, keys.map (key) =>
|
||||
href = window.tree.basepath @props.path+"/"+key
|
||||
|
@ -91,8 +91,20 @@ Links = React.createFactory(query({
|
||||
}, this.props.children, this._render());
|
||||
},
|
||||
_render: function() {
|
||||
var keys, style;
|
||||
keys = _(this.props.kids).keys().sort();
|
||||
var k, keys, ref1, sorted, style, v;
|
||||
sorted = true;
|
||||
keys = [];
|
||||
ref1 = this.props.kids;
|
||||
for (k in ref1) {
|
||||
v = ref1[k];
|
||||
if (!v.meta.sort) {
|
||||
sorted = false;
|
||||
}
|
||||
keys[Number(v.meta.sort)] = k;
|
||||
}
|
||||
if (sorted !== true) {
|
||||
keys = _(this.props.kids).keys().sort();
|
||||
}
|
||||
style = {
|
||||
marginTop: -24 * (keys.indexOf(this.props.curr)) + "px"
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user