99 </p >
1010 </InfoBanner >
1111 <UtilitySection title =" API Configuration" title-heading-level =" h2" >
12- <TextInput
13- id =" butter-api-token"
14- type =" password"
15- placeholder =" Enter your Butter CMS API Token"
16- :required =" true"
17- v-model =" store.token"
18- >
19- <template v-slot :label >Butter CMS API Token</template >
20- <template v-slot :error v-if =" ! store .token "
21- >Please provide your Butter CMS API Token</template
12+ <div class =" app__token-input-container" >
13+ <TextInput
14+ root-class =" app__token-input"
15+ id =" butter-api-token"
16+ type =" password"
17+ placeholder =" Enter your Butter CMS API Token"
18+ :required =" true"
19+ :readonly =" lockToken"
20+ v-model =" store.token"
2221 >
23- </TextInput >
22+ <template v-slot :label >Butter CMS API Token</template >
23+ <template v-slot :error v-if =" ! store .token "
24+ >Please provide your Butter CMS API Token</template
25+ >
26+ </TextInput >
27+ <button
28+ v-if =" store.token"
29+ @click =" toggleTokenLock"
30+ class =" app__lock-button"
31+ :title =" lockToken ? 'Unlock token' : 'Lock token'"
32+ >
33+ {{ lockToken ? '🔒' : '🔓' }}
34+ </button >
35+ </div >
2436 </UtilitySection >
2537
2638 <h2 style =" font-weight : 500 " >Available Utilities</h2 >
3042</template >
3143
3244<script setup lang="ts">
45+ import { ref , watch } from ' vue'
3346import { useStore } from ' ./stores/index'
3447import Header from ' ./components/Header.vue'
3548import Footer from ' ./components/Footer.vue'
@@ -39,9 +52,21 @@ import TextInput from './components/TextInput.vue'
3952import SearchPages from ' ./components/Utilities/SearchPages.vue'
4053
4154const store = useStore ()
55+ const lockToken = ref (localStorage .getItem (' butter_cms_lock_token' ) === ' true' )
56+
57+ watch (
58+ () => lockToken .value ,
59+ (newValue ) => {
60+ localStorage .setItem (' butter_cms_lock_token' , String (newValue ))
61+ },
62+ )
63+
64+ function toggleTokenLock(): void {
65+ lockToken .value = ! lockToken .value
66+ }
4267 </script >
4368
44- <style lang="scss">
69+ <style lang="scss" scoped >
4570#app {
4671 min-height : 100vh ;
4772 display : flex ;
@@ -55,4 +80,46 @@ main {
5580 margin : 0 auto ;
5681 padding : 2rem 1.5rem ;
5782}
83+
84+ .app {
85+ & __token-input-container {
86+ display : flex ;
87+ align-items : center ;
88+ gap : 1rem ;
89+ }
90+
91+ & __token-input {
92+ flex : 1 ;
93+ }
94+
95+ & __lock-button {
96+ margin-top : 1.5rem ;
97+ width : 2.5rem ;
98+ height : 2.5rem ;
99+ padding : 0 ;
100+ background-color : #eee ;
101+ border : 1px solid #b3bac2 ;
102+ border-radius : 6px ;
103+ font-size : 1.25rem ;
104+ cursor : pointer ;
105+ display : flex ;
106+ align-items : center ;
107+ justify-content : center ;
108+ transition : all 0.2s ;
109+ font-family : monospace ;
110+
111+ & :hover {
112+ background-color : #ddd ;
113+ }
114+
115+ & :active {
116+ background-color : #a8aeb8 ;
117+ }
118+
119+ & :focus {
120+ outline : 2px solid #7c8db0 ;
121+ outline-offset : 2px ;
122+ }
123+ }
124+ }
58125 </style >
0 commit comments