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(showcase): embed section #89

Merged
merged 4 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/Projects/Section/sections/Embed/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'

import { IEmbed } from '../../types'
import { Wrapper } from './styled'

const Embed = (props: IEmbed) => {
return <Wrapper dangerouslySetInnerHTML={{ __html: props.code }} />
}

export default Embed
16 changes: 16 additions & 0 deletions src/components/Projects/Section/sections/Embed/styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import styled from '@theme'

export const Wrapper = styled.div`
position: relative;
padding-bottom: 56.25%; /* 16:9 */
Copy link
Member

Choose a reason for hiding this comment

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

Can we safely assume that it's always 16:9?

cc @pedroet

padding-top: 25px;
Copy link
Member

Choose a reason for hiding this comment

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

why this padding-top? I believe we don't have padding in any section and the sectionWrapper takes care of all the top and bottom spacings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

height: 0;

iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
`
1 change: 1 addition & 0 deletions src/components/Projects/Section/sections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export { default as waterfall } from './Waterfall'
export { default as testimonial } from './Testimonial'
export { default as sticky } from './Sticky'
export { default as highlight } from './Highlight'
export { default as embed } from './Embed'
5 changes: 5 additions & 0 deletions src/components/Projects/Section/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ export interface IStickyImage extends IStickyBase {

export type ISticky = IStickyVideo | IStickyImage

// Embed
export interface IEmbed {
pdrbrnd marked this conversation as resolved.
Show resolved Hide resolved
code: string
}

// Highlight
export interface IHighlight {
text: string
Expand Down
3 changes: 3 additions & 0 deletions src/templates/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ export const query = graphql`
# Highlight

#text

# Embed
code
pdrbrnd marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down