Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Youtube Atom (née MediaAtom) #46

Merged
merged 13 commits into from
Sep 8, 2020
Merged

Youtube Atom (née MediaAtom) #46

merged 13 commits into from
Sep 8, 2020

Conversation

nicl
Copy link
Contributor

@nicl nicl commented Aug 27, 2020

UPDATE: have excluded Caption now as the platforms may differ in this and it's a component that is shared more widely too and we'd rather not duplicate it. I've updated the picture accordingly.

What does this change?

Adds (copied from DC) the Youtube/Media Atom. Note, changes have been made to:

  • use Format instead of separate Pillar/Design/Display arguments
  • inline icon SVGs (for now) update: use src here where possible

There are a lot of open questions here, which I wanted to get feedback on before continuing:

  • do we need all of the variants of Caption etc? - I am a bit concerned with the lines of code involved in some of these components, even though they reflect (current) real features/design variations
  • should we just call this YoutubeAtom? (update: yes)
  • how do we handle code reuse for child components, pillar palettes
    etc?

Images

Screenshot 2020-09-07 at 15 23 27

@gtrufitt
Copy link
Contributor

should we just call this YoutubeAtom?

+1

);

type Props = {
format: Format;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels weird to have to bring caption into here when it exists in dotcom rendering? I would say that the caption used for all embeds/images/media etc should be the same? +1 on taking a Format!

@gtrufitt
Copy link
Contributor

Note on the failing compilation:

semantic error TS17016: JSX fragment is not supported when using --jsxFactory

I've seen this elsewhere.

Issue with TS, but can be fixed with babel plugins.
developit/microbundle#623
cision/rover-ui#186

Looks like fixed in TS4.0
microsoft/TypeScript#38720

import { pillarPalette } from './pillarPalette';
import { Pillar } from '@guardian/types/Format';

const Audio = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these the same media icons as in the design system? https://theguardian.design/2a1e5182b/p/3892a2-icons

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I just copied them to get something working, but I'll switch to the source ones!


type colour = string;

interface PillarColours {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be useful in @guardian/types I think? Or maybe design system provides it..?

<div
className={css`
position: absolute;
bottom: 12px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these magic numbers relate to any particular thing that you can assign to a var/ comment to give them context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've used space here now from Source.

Copy link
Contributor

@jfsoul jfsoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. I get the argument for it being called YoutubeAtom, but at the same time Media is the terminology used elsewhere (i.e. tools) so it might be worth documenting somewhere (where?) that they are intended to be equivalent.

};
};

const constructQuery = (query: { [key: string]: any }): string =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose there isn't anywhere more sensible for this to live?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is pretty generic code. I'm not too concerned about this being duplicated though (if it does end up being useful elsewhere), as it's only a few lines of code. Or else to refactor later as an alternative.

@nicl nicl changed the title WIP Media Atom Youtube Atom (née MediaAtom) Sep 8, 2020
@nicl nicl merged commit e9ffa0a into main Sep 8, 2020
@nicl nicl deleted the nicl/media-atom branch September 8, 2020 11:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants