Skip to content

Commit b536b71

Browse files
committed
feat: added .attrs examples
1 parent 833ec62 commit b536b71

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

example/index.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ <h1>Basic Example</h1>
100100
}
101101
`
102102

103+
const ReadonlyStyledInput = styled.default(StyledInput).attrs({ readOnly: true })`
104+
color: ${props => props.theme.disabled};
105+
border-color: ${props => props.theme.disabled};
106+
font-family: ${props => props.noop};
107+
108+
&:focus {
109+
border-color: ${props => props.theme.disabled};
110+
}
111+
`
112+
103113
const Btn = styled.default('button', { visible: Boolean })`
104114
outline: none;
105115
border: none;
@@ -138,7 +148,7 @@ <h1>Basic Example</h1>
138148
el: '#container',
139149
data: {
140150
text1: 'Hello World, this is my first styled component!',
141-
text2: 'Hello World, this is my first styled component!',
151+
text2: 'Hello World, this is my first styled component, I am readonly using .attrs function!',
142152
animated1: false,
143153
animated2: false,
144154
element: 'div',
@@ -148,7 +158,8 @@ <h1>Basic Example</h1>
148158
<theme-provider :theme="{
149159
primary: 'palevioletred',
150160
secondary: 'papayawhip',
151-
tertiary: 'lavenderblush'
161+
tertiary: 'lavenderblush',
162+
disabled: 'gainsboro'
152163
}">
153164
<wrapper>
154165
<custom-title :visible="true" :animate="animated1"> {{text1}} </custom-title>
@@ -157,7 +168,7 @@ <h1>Basic Example</h1>
157168
</wrapper>
158169
<w-2>
159170
<h-2 :animate="animated2"> {{text2}} </h-2>
160-
<styled-input v-model="text2" />
171+
<readonly-styled-input v-model="text2" />
161172
<super-btn visible @click="animated2 = !animated2"> An extension of Styled Button </super-btn>
162173
</w-2>
163174
<w-3
@@ -191,7 +202,8 @@ <h3>Enter any HTML element and see the element rendered by the styled component
191202
CustomBtn,
192203
SuperCustomTitle,
193204
StyledInput,
194-
'theme-provider': styled.ThemeProvider,
205+
ReadonlyStyledInput,
206+
ThemeProvider: styled.ThemeProvider,
195207
},
196208
methods: {
197209
updateElement() {

0 commit comments

Comments
 (0)