Skip to content

Commit d21606d

Browse files
committed
fixing iframes
1 parent e1148b3 commit d21606d

File tree

4 files changed

+45
-35
lines changed

4 files changed

+45
-35
lines changed

examples/cards.js

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,39 @@ export function buildCards() {
1111

1212
abc.card(<Foo message="yo" />, 'here is a simple example')
1313

14-
demo.card(
15-
`## markdown doc
16-
you can use markdown for card documentation
17-
- foo
18-
- bar`,
14+
demo.card(`
15+
## markdown doc
16+
you can use markdown for card documentation
17+
- foo
18+
- bar
19+
`,
1920
<Foo message="hello"/>
2021
)
2122

2223
demo.card(<Foo message="hello world"/>)
2324

2425
demo.card(<Bar/>, {title: 'a bar card'})
2526

26-
demo.card(
27-
`## Counter
27+
demo.card(`
28+
## Counter
2829
29-
This is a stateful counter. If you change the value prop
30-
in the source file it will not update because the new prop will be ignored
31-
and instead the component local state is rendered.
30+
This is a stateful counter. If you change the value prop
31+
in the source file it will not update because the new prop will be ignored
32+
and instead the component local state is rendered.
3233
33-
Implement *componentWillReceiveProps* and override the component local state
34-
if you want this to work as expected.`,
34+
Implement *componentWillReceiveProps* and override the component local state
35+
if you want this to work as expected.
36+
`,
3537

3638
<StatefulCounter value={42}/>
3739
)
3840

39-
demo.card(
40-
`## Stateless Counter
41-
This example shows how to manage state when you have a stateless
42-
component. The card can also dump the current state as JSON if
43-
you set the *inspect* flag to true.`,
44-
41+
demo.card(`
42+
## Stateless Counter
43+
This example shows how to manage state when you have a stateless
44+
component. The card can also dump the current state as JSON if
45+
you set the *inspect* flag to true.
46+
`,
4547
(state) =>
4648
<StatelessCounter
4749
value={state.get()}
@@ -53,10 +55,10 @@ export function buildCards() {
5355
}
5456
)
5557

56-
demo.card(
57-
`## Undo/Redo
58-
Same example as before but with undo/redo controls added by the card.`,
59-
58+
demo.card(`
59+
## Undo/Redo
60+
Same example as before but with undo/redo controls added by the card.
61+
`,
6062
(state) =>
6163
<StatelessCounter
6264
value={state.get()}
@@ -68,11 +70,11 @@ export function buildCards() {
6870
}
6971
)
7072

71-
demo.card(
72-
`## TodoList
73-
A simple todo list showing history and inspect feature
74-
with a little more interesting model than just a simple number.`,
75-
73+
demo.card(`
74+
## TodoList
75+
A simple todo list showing history and inspect feature
76+
with a little more interesting model than just a simple number.
77+
`,
7678
(state) =>
7779
<TodoList items={state.get()}
7880
onSubmit={(text) => state.update(items => [...items, {text, done: false}])}
@@ -89,17 +91,18 @@ export function buildCards() {
8991
)
9092

9193
demo.markdown(`
92-
# a markdown card
93-
this is a simple markdown card
94-
- lorem
95-
- ipsum
94+
# a markdown card
95+
this is a simple markdown card
96+
- lorem
97+
- ipsum
9698
`)
9799

98100
demo.test(testSimple, {title:'simple tests'})
99101

100-
demo.test(
101-
`## component tests
102-
Here you can see the results of some component tests.`,
102+
demo.test(`
103+
## component tests
104+
Here you can see the results of some component tests.
105+
`,
103106
testComponents
104107
)
105108

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"less": "^2.7.1",
2424
"less-loader": "^2.2.3",
2525
"mocha": "^2.4.5",
26+
"raw-loader": "^0.5.1",
2627
"sinon": "^1.17.4",
2728
"style-loader": "^0.13.1",
2829
"tape": "^4.5.1",
@@ -35,10 +36,12 @@
3536
"enzyme": "^2.3.0",
3637
"history": "^2.1.1",
3738
"lodash": "^4.12.0",
39+
"iframe-resizer": "^3.5.3",
3840
"myro": "^0.6.2",
3941
"react": "^15.0.2",
4042
"react-addons-test-utils": "^15.0.2",
4143
"react-dom": "^15.0.2",
44+
"react-frame-component": "^0.6.1",
4245
"react-hot-loader": "^3.0.0-alpha.8",
4346
"showdown": "^1.3.0"
4447
},

src/TestCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default class TestCard extends Component {
7777
render() {
7878
const {title, doc} = this.props
7979
return (
80-
<Card {...{title, doc}}>
80+
<Card noframe {...{title, doc}}>
8181
{this.state.results.map(([result, name], index) => (
8282
result === true
8383
? <TestSuccess key={index}>{name}</TestSuccess>

src/style.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ body {
2424
border-radius:2px;
2525
font-family:sans-serif;
2626
background-color:white;
27+
iframe {
28+
width: 100%;
29+
border: none;
30+
}
2731
}
2832

2933
:local(.cardHeader) {

0 commit comments

Comments
 (0)