Comments (6)
Looks great! Would the new-ish css aspect ratio property work, since it seems to have pretty wide support.
https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio
Another option here is using a directive on the container, as it again alows the user to use any semantic html element they want
<div brnAspectRatio="3/4">
<img ... />
</div>
from spartan.
Since tailwind also supports aspect-ratio out of the box I say we stick with the positioning implementation. https://tailwindcss.com/docs/aspect-ratio
I do think the docs should state that there's a CSS property for that and it should be considered first.
from spartan.
Great! Then numbers work and we just check if its 0 or less
from spartan.
That's a good point! I'd almost say that would be something to mention in future docs. Prefer CSS and fallback to this component.
While I like the directive approach but we'd have to figure out how to wrap the children in the components we need. Content projection seems easier here. Since there will always be DOM nodes to needed to make it work I'd actually say component.
Would be cool to support a ratio in text form instead of a number. Maybe we can support the most common ones as text?
from spartan.
Probably easier if its all text tbh as otherwise we need to parse out 16/9 out of 5.3333 since ng will just divide the numbers. We could use template literals to restrict it tho what we want. Otherwise were sort of forced into the position relative + absolute way of solving it.
type Ratio = `${number}/${number}`
Tho I also am up for aliasing a few common ones with declarative strings such as widescreen/phone etc.
I see what you mean with components, it sort of depends on impl here id say since all we need to do is add a single css property to the parent here. If we however wanted to do the relative/absolute approach a component would be easier.
from spartan.
It actually does not need to be the two values but can use the number directly.
Writing height / width is just how we naturally think about it.
But with the type you suggested parsing probably wouldn't be too bad either.
I guess we just have to make sure we're not dividing by 0 or the aspect ratio is 0 and we should be good.
Now I am leaning to supporting both 😂
from spartan.
Related Issues (20)
- RFC: Advanced pagination
- RFC: Radio Groups as card layouts HOT 6
- Docs: API reference for all components
- Renaming the generated `hlm-` selector to anything else breaks the `select` component HOT 10
- Popover overflowing past screen when trigger is on the edge of the screen HOT 3
- Add the multi select component
- Peer dependencies causing problem - multiple versions of ui-core HOT 3
- ERROR RuntimeError: NG0203: inject() must be called from an injection context such as a constructor
- ERROR ReferenceError: window is not defined HOT 1
- [nitro] [request error] [unhandled] [GET] "/trpc/note.list,note.list
- Error: Error: Cannot find module tslib ... code: 'ERR_MODULE_NOT_FOUND'
- (node:77788) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern
- Dropdown does not lock page scroll HOT 6
- Select: Initial Value is not set when options are provided vie @for
- Adding the hlmMenuItem directive on dropdown separated in multiple components throw an exception HOT 1
- unable to install nx-workspace with presets HOT 1
- hlmSelect does not have an invalid state style HOT 9
- Module Not recognize HOT 2
- Select does not work with number 0 and ngModel
- Brn and Hlm Error Directive for Form Fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spartan.