A possible enhancement in code samples
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
As a user of a component set, I pay attention to the demos first and then to the code samples. Usually, my starting point is to use a ready-made sample component. And I expect the provided code to work with minimal changes.
In this regard, it seems that the code example for "Basic List with custom role and class"(or probably many other samples) can be improved. it has a build error.
In the first place, I couldn't run this code sample on my page because :
- there is no "People" array object defined in the code sample so I had a build error.
- Peope[1] is used in another demo and it made me confused at first glance.
- it needs some styles to make the output of code like the real demo. PS At the moment I have no problems using it and I am sharing this feedback only to improve the documentation.
Describe the solution you'd like
I prefer to have something like this:
<BitBasicList Items="People"
Virtualize="true"
Role="list"
class="p-10 grid grid-cols-1 sm:grid-cols-1 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-3 gap-5">
<RowTemplate Context="person">
<div class="lst3-list-item">
<span>Id: <strong>@person.Id</strong></span>
<span>Full Name: <strong>@person.FirstName</strong></span>
<span>Job: <strong>@person.Job</strong></span>
</div>
</RowTemplate>
</BitBasicList>
<style>
.lst3-list-item {
padding: 16px 20px;
background-color: #f2f2f2;
margin: 10px 10px;
width: 20%;
height: 143px;
display: inline-grid;
justify-content: center;
align-items: center;
}
</style>
@code {
List<Person> People = new();
protected override void OnInitialized()
{
Person person = new();
People = person.GetPeople(8000);
base.OnInitialized();
}
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Job { get; set; }
public List<Person> GetPeople(int itemCount)
{
List<Person> people = new();
for (int i = 0; i < itemCount; i++)
{
people.Add(new Person
{
Id = i + 1,
FirstName = $"Person {i + 1}",
LastName = $"Person Family {i + 1}",
Job = $"Programmer {i + 1}"
});
}
return people;
}
}
}
Additional context
No response
Thanks for sharing your feedback Is it possible for you to submit a PR for this?
Thanks for sharing your feedback Is it possible for you to submit a PR for this?
Let me check the code, if modifying it does not affect other codes, I will be happy to do so