Comments (12)
I'll work on this if that's alright 👍
from yari.
Freudian slip... lol
Made more progress on this over lunch, starting to look pretty close. Going to convert it to a class and then submit a drafted PR for some preliminary review
from yari.
@peterbe For now i took some of the CSS from the current BCD table on the beta site. It looks pretty close to what is on the site minus the icons. When i get the rest of the base functionality in there I'll definitely reach out to @schalkneethling to get the full CSS and it should fall into place. Where is the source for the CSS anyway? I'll also put up a draft PR soon for some feedback.
from yari.
Currently looks like this, i updated a little more since the screenshot but it's getting there.
from yari.
Currently i'm using vanilla JS to handle the whole "notes" portion where you click the cell and see the dropdown. I'm going to convert it to a class to get the lifecycle methods in there and set state to handle the "notes" stuff instead.
That's awesome!
The other thing we might want to do is not only to lazy load the BCD data but the whole React component. Then, when the component mounts, it fetches the data. That means the main bundle of JS won't have to carry the JavaScript code that you're working on.
I.e. intersection observed --> load bcd js bundle --> XHR for bcd data --> render.
Again, I think this is premature for right now. But do keep in mind.
Note-to-self; This is a huuuuge BCD table https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
from yari.
* Get the component feature parody
Funny. :)
from yari.
I'm totally OK with this if @peterbe is.
from yari.
@joedarc Do you have what you need to be able to start on this?
For one thing, if the CSS gets too hairy, I would advice that you ping @schalkneethling on the CSS bits. He worked on the CSS for the refactor inside Kuma.
from yari.
Mind you, stumptown-renderer uses SCSS files at the moment. (We might switch to css-in-js in the future but due to legacy and ergonomics I don't want to do this until the dust has really settled).
So when you say "took some of the CSS" you might succeed to copy the relevant SCSS definitions too.
from yari.
PS. @joedarc One idea I'm floating is to render the BCD tables async after document load from an XHR request. The payload to render and hydrate with the full table might be a perf drag and since it's almost always far down on the page, it serve us better to only load it in dynamically as you scroll down the page. I don't think this comment is relevant to your progress since the core is a good React component, but I just thought I'd share the thought.
from yari.
So when you say "took some of the CSS" you might succeed to copy the relevant SCSS definitions too.
Yeah i took the CSS from the inspecting the beta page BCD table, i mainly wanted to get it to look as similar as possible so that i got it attaching the correct classes to the rendered elements and it should fall into place with the correct CSS. I put the CSS i got into the main SCSS file but that may change as this further progresses.
only load it in dynamically as you scroll down the page
Noted, yeah i agree with this.
Currently i'm using vanilla JS to handle the whole "notes" portion where you click the cell and see the dropdown. I'm going to convert it to a class to get the lifecycle methods in there and set state to handle the "notes" stuff instead.
from yari.
Yeah, agree with everything you said. Right now i think my internal checklist for this is:
- Get the component feature
parodyparity - Get the correct styles in there, adjust if necessary
- Convert the component to be a class and redo the "notes" to use state which will clean it up a good bit
When we're happy with the results of that then:
- Have some handler on the main component that tracks when to actually mount the BCD
- On mount, fetch the compatibility data, update state, that'll trigger the render to show the table
Something like that.
from yari.
Related Issues (20)
- Formal syntax in PR Preview is different HOT 1
- [cli] The `fix-flaws` command corrects `/discord` to full invite URL HOT 1
- Feature Request: make `{{AvailableInWorkers}}` macros support to specific worker type
- "Accessibility" link in "Guides" menu directs to "References" section on MDN
- CSS Filter's Formal Syntax section contains broken links on the filter functions HOT 2
- Double slash in URL prevents demos from loading HOT 2
- Art gallery example canvas does not display correctly HOT 1
- Migrate search-index command from deployer to tool
- The BCD section id is not localized in Baseline Indicator HOT 4
- Update Twitter logo on the MDN website to X. HOT 2
- (Ru) The table on 'Guide/Regular_expressions' page is cropped HOT 1
- 🐛 Some MathML articles not shown in menu HOT 2
- Docs/Web/CSS sidebar contains inconsistent spacing between sections HOT 1
- The headings have been styled as normal links HOT 2
- Error in the CSS Styles Page HOT 3
- @swc/core >= 1.3.81 fails with SyntaxError: Unexpected token 'with'
- Example code won't execute when invoked by its URL directly HOT 1
- Visited links are unreadable in dark mode HOT 5
- Tables in the MDN blog cause scrolling or get clipped HOT 2
- "MDN Chat" link in the website footer is expired
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 yari.