Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/video label #704

Merged
merged 21 commits into from
Mar 7, 2018
Merged

Feat/video label #704

merged 21 commits into from
Mar 7, 2018

Conversation

nikhedonia
Copy link
Contributor

@nikhedonia nikhedonia commented Mar 6, 2018

Implements video label as a seperate package.
In order to avoid magic numbers when using the video-icon inside the video label, I made width of icons optional and compute the width from the aspect ratio and height.

videolabel

reference: https://www.thetimes.co.uk/past-six-days/2018-03-06/sport/weekend-review-mourinhos-tumble-richarlisons-tantrum-and-dioufs-spat-tfsfwtbkf

@nikhedonia nikhedonia force-pushed the feat/video-label branch 6 times, most recently from fa69f3d to 1ddb933 Compare March 6, 2018 18:15
import renderer from "react-test-renderer";
import VideoLabel from "../video-label";

module.exports = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

export default


const styles = {
title: {
...sharedStyles.title
Copy link
Contributor

Choose a reason for hiding this comment

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

these index files do not seem to add anything...

<Text style={[styles.title, { color, marginLeft: 5 }]}>
{beautifyTitle("VIDEO")}
</Text>
{title ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

&& instead of a ternary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to my surprise this does not seem to work:

Unexpected text node: . A text node cannot be a child of a <View>.

{title ? (
<Text style={[styles.title, { color, marginLeft: 3 }]}>|</Text>
) : null}
{title ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

&&

.add("VideoLabel with title", () => (
<VideoLabel
title="SWIMMING"
color={select(
Copy link
Contributor

Choose a reason for hiding this comment

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

nice knobs

// apply transformations to add uppercase and letter spacing.
// letterSpacing CSS prop does not work on android:
// https://github.com/facebook/react-native/pull/13199
const beautifyTitle = title =>
Copy link
Contributor

@aronshamash aronshamash Mar 7, 2018

Choose a reason for hiding this comment

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

maybe we can now get rid of this letter spacing hack in light of facebook/react-native#17398. Just need to check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not part of react-native-0.53.3

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

{title ? (
<Text style={[styles.title, { color, paddingLeft: 3 }]}>{title}</Text>
<Text style={[styles.title, { color, paddingLeft: 5 }]}>{title.toUpperCase()}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

better

@@ -6,8 +6,9 @@ import iconPropTypes from "./proptypes";
const viewBox =
"0.15463916957378387 0.049614034593105316 23.59917640686035 13.728596687316895";

const ratio = 1.72;
Copy link
Contributor

@aronshamash aronshamash Mar 7, 2018

Choose a reason for hiding this comment

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

In twitter.js we using a ratio here we using a decimal. Can use 43 / 25 for video and 75 / 60 for twitter. Other than this it seems good to merge

@aronshamash aronshamash merged commit d13c2a5 into master Mar 7, 2018
@aronshamash aronshamash deleted the feat/video-label branch March 7, 2018 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants