nib icon indicating copy to clipboard operation
nib copied to clipboard

-pos proposal

Open pgherveou opened this issue 14 years ago • 3 comments

Hello TJ what do you think about adding this line of code to the position helper, most of the time when I use fixed or absolute I fix the top/bottom and stretch the element setting both right and left.


-pos(type, args)
  i = 0
  position: unquote(type)
  {args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  if length(args) > i + 1
    {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0

body
  fixed: top 0 right 5px left 5px


pgherveou avatar Dec 25 '11 11:12 pgherveou

+1

thats how my -pos looks like :D

-pos(type, args)
  i = 0
  position: unquote(type)
  {args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0

guybrush avatar Dec 25 '11 12:12 guybrush

I am new to stylus, so not sure about that but doesn't your solution add a null: 0 to the css if you don't specify the fourth argument ?

pgherveou avatar Dec 27 '11 18:12 pgherveou

you are right, my -pos is really just a quick hack without thinking about it - its only ok for me because i am defining all 4 positions everytime.

still +1 for this :D

maybe like that?

-pos(type, args)
  i = 0
  position: unquote(type)
  {args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  if length(args) > i + 1
    {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
  if length(args) > i + 1
    {args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0

guybrush avatar Dec 29 '11 08:12 guybrush