Skip to content

Commit

Permalink
gsuiTitleUser: attr readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
mr21 committed Oct 26, 2024
1 parent cda980f commit 39b3dfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gsuiTitleUser/gsuiTitleUser.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ gsui-titleuser:not( [ connected ] ) .gsuiTitleUser-user {
display: flex;
height: 20px;
border-radius: 4px;
background-color: #6677aa;
background-color: #67a;
}
gsui-titleuser[ readonly ] .gsuiTitleUser-cmp {
background-color: #a66;
}

/* .......................................................................... */
Expand All @@ -107,6 +110,9 @@ gsui-titleuser:not( [ connected ] ) .gsuiTitleUser-user {
background-color: #ba5d5d;
transition: width .2s;
}
gsui-titleuser[ readonly ] .gsuiTitleUser-save {
display: none;
}
gsui-titleuser[ saved ] .gsuiTitleUser-save {
width: 0;
}
Expand Down Expand Up @@ -148,12 +154,15 @@ gsui-titleuser[ just-saved ] .gsuiTitleUser-justSaved {
text-overflow: ellipsis;
padding-right: 2px;
}
gsui-titleuser[ readonly ] .gsuiTitleUser-cmpName {
font-style: italic;
}
.gsuiTitleUser-cmpName:empty::after {
content: "Untitled";
font-style: italic;
opacity: .7;
}
gsui-titleuser:not( [ saved ] ) .gsuiTitleUser-cmpName::before {
gsui-titleuser:not( [ saved ] ):not( [ readonly ] ) .gsuiTitleUser-cmpName::before {
content: "*";
}
.gsuiTitleUser-cmpEditIcon {
Expand Down
3 changes: 3 additions & 0 deletions gsuiTitleUser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<gsui-titleuser avatar="../test-assets/avatar.jpg"></gsui-titleuser>
</div>
<div id="TEST-CTRLS">
<div><button id="readonly">toggle readonly</button></div>
<div><button id="connected">toggle connected</button></div>
<div><button id="connecting">toggle connecting</button></div>
<div><button id="disconnecting">toggle disconnecting</button></div>
Expand All @@ -54,6 +55,7 @@
<!-- ....................................................................... -->
<script>
const elCmp = document.querySelector( "gsui-titleuser" );
const readonly = document.querySelector( "#readonly" );
const connected = document.querySelector( "#connected" );
const connecting = document.querySelector( "#connecting" );
const disconnecting = document.querySelector( "#disconnecting" );
Expand All @@ -63,6 +65,7 @@
const cmpName = document.querySelector( "#cmpName" );
const longUser = document.querySelector( "#longUser" );

readonly.onclick = () => GSUtoggleAttribute( elCmp, "readonly" );
connected.onclick = () => GSUtoggleAttribute( elCmp, "connected" );
connecting.onclick = () => GSUtoggleAttribute( elCmp, "connecting" );
disconnecting.onclick = () => GSUtoggleAttribute( elCmp, "disconnecting" );
Expand Down

0 comments on commit 39b3dfd

Please sign in to comment.